Restructuring the STT structure
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# Local Pipecat Whisper — no GapGPT / OpenAI cloud key required for STT.
|
||||
# Use a local size: tiny | base | small | medium | large-v3
|
||||
# Do NOT use cloud names like whisper-1
|
||||
STT_MODEL=small
|
||||
STT_DEVICE=cpu
|
||||
STT_COMPUTE_TYPE=int8
|
||||
|
||||
+33
-2
@@ -39,8 +39,39 @@ def _require_token(header_token: str | None) -> None:
|
||||
|
||||
|
||||
def _model_name() -> str:
|
||||
# faster-whisper / Pipecat: tiny | base | small | medium | large-v3 | ...
|
||||
return _env("STT_MODEL", "small") or "small"
|
||||
"""Map env / legacy cloud names to Faster-Whisper local sizes."""
|
||||
raw = (_env("STT_MODEL", "small") or "small").lower()
|
||||
# Old GapGPT/OpenAI cloud id — not a local Whisper size
|
||||
legacy = {
|
||||
"whisper-1": "small",
|
||||
"whisper": "small",
|
||||
"gpt-4o-transcribe": "small",
|
||||
"gpt-4o-mini-transcribe": "base",
|
||||
}
|
||||
if raw in legacy:
|
||||
return legacy[raw]
|
||||
allowed = {
|
||||
"tiny",
|
||||
"tiny.en",
|
||||
"base",
|
||||
"base.en",
|
||||
"small",
|
||||
"small.en",
|
||||
"medium",
|
||||
"medium.en",
|
||||
"large",
|
||||
"large-v1",
|
||||
"large-v2",
|
||||
"large-v3",
|
||||
"distil-large-v2",
|
||||
"distil-medium.en",
|
||||
"distil-large-v3",
|
||||
"large-v3-turbo",
|
||||
}
|
||||
if raw in allowed:
|
||||
return raw
|
||||
# unknown → safe default for Persian
|
||||
return "small"
|
||||
|
||||
|
||||
def _stt_service() -> WhisperSTTService:
|
||||
|
||||
Reference in New Issue
Block a user