

fix: models route returning non-asr models
@3e501dd2d4472f199deeb969633400197d3b5aa8
--- faster_whisper_server/main.py
+++ faster_whisper_server/main.py
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 |
|
87 | 87 |
@app.get("/v1/models") |
88 | 88 |
def get_models() -> list[ModelObject]: |
89 |
- models = huggingface_hub.list_models(library="ctranslate2") |
|
89 |
+ models = huggingface_hub.list_models(library="ctranslate2", tags="automatic-speech-recognition") |
|
90 | 90 |
models = [ |
91 | 91 |
ModelObject( |
92 | 92 |
id=model.id, |
... | ... | @@ -105,7 +105,9 @@ |
105 | 105 |
def get_model( |
106 | 106 |
model_name: Annotated[str, Path(example="Systran/faster-distil-whisper-large-v3")], |
107 | 107 |
) -> ModelObject: |
108 |
- models = list(huggingface_hub.list_models(model_name=model_name, library="ctranslate2")) |
|
108 |
+ models = list( |
|
109 |
+ huggingface_hub.list_models(model_name=model_name, library="ctranslate2", tags="automatic-speech-recognition") |
|
110 |
+ ) |
|
109 | 111 |
if len(models) == 0: |
110 | 112 |
raise HTTPException(status_code=404, detail="Model doesn't exists") |
111 | 113 |
exact_match: ModelInfo | None = None |
--- tests/api_model_test.py
+++ tests/api_model_test.py
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 |
|
5 | 5 |
MODEL_THAT_EXISTS = "Systran/faster-whisper-tiny.en" |
6 | 6 |
MODEL_THAT_DOES_NOT_EXIST = "i-do-not-exist" |
7 |
-MIN_EXPECTED_NUMBER_OF_MODELS = 200 # At the time of the test creation there are 228 models |
|
7 |
+MIN_EXPECTED_NUMBER_OF_MODELS = 70 # At the time of the test creation there are 89 models |
|
8 | 8 |
|
9 | 9 |
|
10 | 10 |
# HACK: because ModelObject(**data) doesn't work |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?