Skip to content

Commit

Permalink
add version endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
MayNiklas committed Nov 2, 2024
1 parent 2d77714 commit 341d4e6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/whisper_api/api_endpoints/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from fastapi.responses import RedirectResponse
from fastapi.responses import StreamingResponse

from whisper_api import __version__
from whisper_api.data_models.data_types import named_temp_file_name_t
from whisper_api.data_models.data_types import task_type_str_t
from whisper_api.data_models.data_types import uuid_hex_t
Expand Down Expand Up @@ -54,6 +55,7 @@ def add_endpoints(self):
self.app.add_api_route(f"{V1_PREFIX}/userinfo", self.userinfo)
self.app.add_api_route(f"{V1_PREFIX}/login", self.login)
self.app.add_api_route(f"{V1_PREFIX}/srt", self.srt)
self.app.add_api_route(f"{V1_PREFIX}/version", self.get_version_info)
if AUTHORIZED_MAILS:
self.app.add_api_route(f"{V1_PREFIX}/logs", self.get_logs)

Expand Down Expand Up @@ -244,3 +246,12 @@ def is_file_audio(file_path: str) -> bool:
except ffmpeg.Error as e:
logger.warning(e.stderr)
return False

@staticmethod
def get_version_info(request: Request):
"""
Returns information about the version being deployed.
:param request: request object
:return: dict with version info
"""
return {"version": __version__}

0 comments on commit 341d4e6

Please sign in to comment.