Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
LOGGER = logging.getLogger(os.environ["APP_ID"])
LOGGER.setLevel(logging.DEBUG)

# --- VAD configuration (Silero, bundled with faster-whisper) ---
# Enabled by default; disable by setting STT_WHISPER2_VAD_FILTER=0 in the container env.
# Tunables map 1:1 onto faster_whisper.vad.VadOptions.
VAD_FILTER = os.environ.get("STT_WHISPER2_VAD_FILTER", "1") == "1"
VAD_PARAMETERS = {
Comment thread
marcelklehr marked this conversation as resolved.
Outdated
"threshold": float(os.environ.get("STT_WHISPER2_VAD_THRESHOLD", "0.5")),
"min_speech_duration_ms": int(os.environ.get("STT_WHISPER2_VAD_MIN_SPEECH_MS", "0")),
"min_silence_duration_ms": int(os.environ.get("STT_WHISPER2_VAD_MIN_SILENCE_MS", "2000")),
"speech_pad_ms": int(os.environ.get("STT_WHISPER2_VAD_SPEECH_PAD_MS", "400")),
}


Comment thread
marcelklehr marked this conversation as resolved.
Outdated
def load_models():
models = {}
Expand Down Expand Up @@ -144,7 +155,11 @@ def background_thread_task():
LOGGER.info("generating transcription")
time_start = perf_counter()
file_name = get_file(nc, task["id"], task.get("input").get('input'))
segments, info = model.transcribe(file_name)
segments, info = model.transcribe(
file_name,
vad_filter=VAD_FILTER,
vad_parameters=VAD_PARAMETERS if VAD_FILTER else None,
)
transcript = ''
for segment in segments:
transcript += segment.text
Expand Down
Loading