• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
yjyoon / whisper_server_speaches star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
whisper_server_speachessrcspeachesroutersmodels.py
Download as .zip file
File name
Commit message
Commit date
.github/workflows
feat: switch to ghcr.io
01-10
configuration
feat: add instrumentation
2024-12-17
docs
rename to `speaches`
01-12
examples
rename to `speaches`
01-12
scripts
chore: misc changes
2024-10-03
src/speaches
rename to `speaches`
01-12
tests
rename to `speaches`
01-12
.dockerignore
chore: update .dockerignore
2024-11-01
.envrc
init
2024-05-20
.gitattributes
chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.7.2
2024-11-02
.gitignore
chore: update .gitignore
2024-07-03
.pre-commit-config.yaml
docs: usage pages (and more)
01-12
Dockerfile
rename to `speaches`
01-12
LICENSE
init
2024-05-20
README.md
rename to `speaches`
01-12
Taskfile.yaml
rename to `speaches`
01-12
audio.wav
chore: update volume names and mount points
01-10
compose.cpu.yaml
rename to `speaches`
01-12
compose.cuda-cdi.yaml
rename to `speaches`
01-12
compose.cuda.yaml
rename to `speaches`
01-12
compose.observability.yaml
rename to `speaches`
01-12
compose.yaml
rename to `speaches`
01-12
flake.lock
deps: update flake
2024-11-01
flake.nix
chore(deps): add loki and tempo package to flake
2024-12-17
mkdocs.yml
rename to `speaches`
01-12
pyproject.toml
rename to `speaches`
01-12
renovate.json
feat: renovate handle pre-commit
2024-11-01
uv.lock
rename to `speaches`
01-12
File name
Commit message
Commit date
routers
rename to `speaches`
01-12
__init__.py
rename to `speaches`
01-12
api_models.py
rename to `speaches`
01-12
asr.py
rename to `speaches`
01-12
audio.py
rename to `speaches`
01-12
config.py
rename to `speaches`
01-12
dependencies.py
rename to `speaches`
01-12
gradio_app.py
rename to `speaches`
01-12
hf_utils.py
rename to `speaches`
01-12
logger.py
rename to `speaches`
01-12
main.py
rename to `speaches`
01-12
model_manager.py
rename to `speaches`
01-12
text_utils.py
rename to `speaches`
01-12
text_utils_test.py
rename to `speaches`
01-12
transcriber.py
rename to `speaches`
01-12
File name
Commit message
Commit date
__init__.py
rename to `speaches`
01-12
misc.py
rename to `speaches`
01-12
models.py
rename to `speaches`
01-12
speech.py
rename to `speaches`
01-12
stt.py
rename to `speaches`
01-12
Fedir Zadniprovskyi 01-12 43cc67a rename to `speaches` UNIX
Raw Open in browser Change history
from __future__ import annotations from typing import TYPE_CHECKING, Annotated from fastapi import ( APIRouter, HTTPException, Path, ) import huggingface_hub from speaches.api_models import ( ListModelsResponse, Model, ) from speaches.hf_utils import list_whisper_models if TYPE_CHECKING: from huggingface_hub.hf_api import ModelInfo router = APIRouter(tags=["models"]) @router.get("/v1/models") def get_models() -> ListModelsResponse: whisper_models = list(list_whisper_models()) return ListModelsResponse(data=whisper_models) @router.get("/v1/models/{model_name:path}") def get_model( # NOTE: `examples` doesn't work https://github.com/tiangolo/fastapi/discussions/10537 model_name: Annotated[str, Path(example="Systran/faster-distil-whisper-large-v3")], ) -> Model: models = huggingface_hub.list_models( model_name=model_name, library="ctranslate2", tags="automatic-speech-recognition", cardData=True ) models = list(models) models.sort(key=lambda model: model.downloads or -1, reverse=True) if len(models) == 0: raise HTTPException(status_code=404, detail="Model doesn't exists") exact_match: ModelInfo | None = None for model in models: if model.id == model_name: exact_match = model break if exact_match is None: raise HTTPException( status_code=404, detail=f"Model doesn't exists. Possible matches: {', '.join([model.id for model in models])}", ) assert exact_match.created_at is not None assert exact_match.card_data is not None assert exact_match.card_data.language is None or isinstance(exact_match.card_data.language, str | list) if exact_match.card_data.language is None: language = [] elif isinstance(exact_match.card_data.language, str): language = [exact_match.card_data.language] else: language = exact_match.card_data.language return Model( id=exact_match.id, created=int(exact_match.created_at.timestamp()), object_="model", owned_by=exact_match.id.split("/")[0], language=language, )

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up