

chore: misc changes
@8f29df15dc8e6d7029c8f543f889fd40740293c9
--- scripts/client.py
+++ scripts/client.py
... | ... | @@ -36,8 +36,11 @@ |
36 | 36 |
USER = "nixos" |
37 | 37 |
TIMEOUT = httpx.Timeout(None) |
38 | 38 |
KEYBIND = "ctrl+x" |
39 |
-LANGUAGE = "en" |
|
40 |
-RESPONSE_FORMAT = "text" |
|
39 |
+REQUEST_KWARGS = { |
|
40 |
+ "language": "en", |
|
41 |
+ "response_format": "text", |
|
42 |
+ "vad_filter": True, |
|
43 |
+} |
|
41 | 44 |
|
42 | 45 |
client = httpx.Client(base_url=OPENAI_BASE_URL, timeout=TIMEOUT) |
43 | 46 |
is_running = threading.Event() |
... | ... | @@ -69,10 +72,7 @@ |
69 | 72 |
res = client.post( |
70 | 73 |
OPENAI_BASE_URL + TRANSCRIBE_PATH, |
71 | 74 |
files={"file": fd}, |
72 |
- data={ |
|
73 |
- "response_format": RESPONSE_FORMAT, |
|
74 |
- "language": LANGUAGE, |
|
75 |
- }, |
|
75 |
+ data=REQUEST_KWARGS, |
|
76 | 76 |
) |
77 | 77 |
end = time.perf_counter() |
78 | 78 |
print(f"Transcription took {end - start} seconds") |
--- src/faster_whisper_server/routers/stt.py
+++ src/faster_whisper_server/routers/stt.py
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 |
from fastapi.responses import StreamingResponse |
19 | 19 |
from fastapi.websockets import WebSocketState |
20 | 20 |
from faster_whisper.vad import VadOptions, get_speech_timestamps |
21 |
-from pydantic import AfterValidator |
|
21 |
+from pydantic import AfterValidator, Field |
|
22 | 22 |
|
23 | 23 |
from faster_whisper_server.api_models import ( |
24 | 24 |
DEFAULT_TIMESTAMP_GRANULARITIES, |
... | ... | @@ -120,7 +120,17 @@ |
120 | 120 |
return model_name |
121 | 121 |
|
122 | 122 |
|
123 |
-ModelName = Annotated[str, AfterValidator(handle_default_openai_model)] |
|
123 |
+ModelName = Annotated[ |
|
124 |
+ str, |
|
125 |
+ AfterValidator(handle_default_openai_model), |
|
126 |
+ Field( |
|
127 |
+ description="The ID of the model. You can get a list of available models by calling `/v1/models`.", |
|
128 |
+ examples=[ |
|
129 |
+ "Systran/faster-distil-whisper-large-v3", |
|
130 |
+ "bofenghuang/whisper-large-v2-cv11-french-ct2", |
|
131 |
+ ], |
|
132 |
+ ), |
|
133 |
+] |
|
124 | 134 |
|
125 | 135 |
|
126 | 136 |
@router.post( |
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?