Skip to content

Commit

Permalink
Add extra metadata to the openAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Stax124 committed Jan 16, 2024
1 parent 185b1db commit 187031d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 14 additions & 1 deletion api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,20 @@ async def log_request(request: Request):


app = FastAPI(
docs_url="/api/docs", redoc_url="/api/redoc", dependencies=[Depends(log_request)]
# Docs
docs_url="/api/docs",
redoc_url="/api/redoc",
swagger_ui_parameters={
"filter": True,
},
# Middleware
dependencies=[Depends(log_request)],
# Metadata
title="VoltaML",
license_info={
"name": "General Public License v3.0",
"url": "https://www.gnu.org/licenses/gpl-3.0.en.html",
},
)

mimetypes.init()
Expand Down
6 changes: 4 additions & 2 deletions core/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import threading
from io import BytesIO
from pathlib import Path
from typing import Dict, List, Union
from typing import Any, Dict, List, Union

import piexif
import piexif.helper
Expand Down Expand Up @@ -93,7 +93,9 @@ def img_to_bytes(img: Image.Image) -> bytes:
return output.getvalue()


def images_to_response(images: Union[List[Image.Image], List[str]], time: float):
def images_to_response(
images: Union[List[Image.Image], List[str]], time: float
) -> Union[dict[str, Any], Response]:
"Generate a valid response for the API"

if len(images) == 0:
Expand Down

0 comments on commit 187031d

Please sign in to comment.