Skip to content

Commit

Permalink
chore: misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedir Zadniprovskyi authored and fedirz committed Oct 2, 2024
1 parent 7723ee9 commit 3dcd817
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 6 additions & 6 deletions scripts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
USER = "nixos"
TIMEOUT = httpx.Timeout(None)
KEYBIND = "ctrl+x"
LANGUAGE = "en"
RESPONSE_FORMAT = "text"
REQUEST_KWARGS = {
"language": "en",
"response_format": "text",
"vad_filter": True,
}

client = httpx.Client(base_url=OPENAI_BASE_URL, timeout=TIMEOUT)
is_running = threading.Event()
Expand Down Expand Up @@ -69,10 +72,7 @@
res = client.post(
OPENAI_BASE_URL + TRANSCRIBE_PATH,
files={"file": fd},
data={
"response_format": RESPONSE_FORMAT,
"language": LANGUAGE,
},
data=REQUEST_KWARGS,
)
end = time.perf_counter()
print(f"Transcription took {end - start} seconds")
Expand Down
14 changes: 12 additions & 2 deletions src/faster_whisper_server/routers/stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from fastapi.responses import StreamingResponse
from fastapi.websockets import WebSocketState
from faster_whisper.vad import VadOptions, get_speech_timestamps
from pydantic import AfterValidator
from pydantic import AfterValidator, Field

from faster_whisper_server.api_models import (
DEFAULT_TIMESTAMP_GRANULARITIES,
Expand Down Expand Up @@ -120,7 +120,17 @@ def handle_default_openai_model(model_name: str) -> str:
return model_name


ModelName = Annotated[str, AfterValidator(handle_default_openai_model)]
ModelName = Annotated[
str,
AfterValidator(handle_default_openai_model),
Field(
description="The ID of the model. You can get a list of available models by calling `/v1/models`.",
examples=[
"Systran/faster-distil-whisper-large-v3",
"bofenghuang/whisper-large-v2-cv11-french-ct2",
],
),
]


@router.post(
Expand Down

0 comments on commit 3dcd817

Please sign in to comment.