Fedir Zadniprovskyi commited on
Commit
6eabeb2
·
1 Parent(s): ddc67e6

chore: misc changes

Browse files
scripts/client.py CHANGED
@@ -36,8 +36,11 @@ TRANSCRIBE_PATH = "/audio/transcriptions?language=en"
36
  USER = "nixos"
37
  TIMEOUT = httpx.Timeout(None)
38
  KEYBIND = "ctrl+x"
39
- LANGUAGE = "en"
40
- RESPONSE_FORMAT = "text"
 
 
 
41
 
42
  client = httpx.Client(base_url=OPENAI_BASE_URL, timeout=TIMEOUT)
43
  is_running = threading.Event()
@@ -69,10 +72,7 @@ while True:
69
  res = client.post(
70
  OPENAI_BASE_URL + TRANSCRIBE_PATH,
71
  files={"file": fd},
72
- data={
73
- "response_format": RESPONSE_FORMAT,
74
- "language": LANGUAGE,
75
- },
76
  )
77
  end = time.perf_counter()
78
  print(f"Transcription took {end - start} seconds")
 
36
  USER = "nixos"
37
  TIMEOUT = httpx.Timeout(None)
38
  KEYBIND = "ctrl+x"
39
+ REQUEST_KWARGS = {
40
+ "language": "en",
41
+ "response_format": "text",
42
+ "vad_filter": True,
43
+ }
44
 
45
  client = httpx.Client(base_url=OPENAI_BASE_URL, timeout=TIMEOUT)
46
  is_running = threading.Event()
 
72
  res = client.post(
73
  OPENAI_BASE_URL + TRANSCRIBE_PATH,
74
  files={"file": fd},
75
+ data=REQUEST_KWARGS,
 
 
 
76
  )
77
  end = time.perf_counter()
78
  print(f"Transcription took {end - start} seconds")
src/faster_whisper_server/routers/stt.py CHANGED
@@ -18,7 +18,7 @@ from fastapi import (
18
  from fastapi.responses import StreamingResponse
19
  from fastapi.websockets import WebSocketState
20
  from faster_whisper.vad import VadOptions, get_speech_timestamps
21
- from pydantic import AfterValidator
22
 
23
  from faster_whisper_server.api_models import (
24
  DEFAULT_TIMESTAMP_GRANULARITIES,
@@ -120,7 +120,17 @@ def handle_default_openai_model(model_name: str) -> str:
120
  return model_name
121
 
122
 
123
- ModelName = Annotated[str, AfterValidator(handle_default_openai_model)]
 
 
 
 
 
 
 
 
 
 
124
 
125
 
126
  @router.post(
 
18
  from fastapi.responses import StreamingResponse
19
  from fastapi.websockets import WebSocketState
20
  from faster_whisper.vad import VadOptions, get_speech_timestamps
21
+ from pydantic import AfterValidator, Field
22
 
23
  from faster_whisper_server.api_models import (
24
  DEFAULT_TIMESTAMP_GRANULARITIES,
 
120
  return model_name
121
 
122
 
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
+ ]
134
 
135
 
136
  @router.post(