From 83d3a52df7ab1a6296312501e445da7133f7baaa Mon Sep 17 00:00:00 2001 From: Brummel Date: Tue, 14 Apr 2026 00:22:36 +0200 Subject: [PATCH] Add hotwords form field to whisper service Hotwords give per-request logit boosts to specified terms throughout decoding (not just as prefix context like initial_prompt). Measured on a cardiology dictation: 8/8 correct fachbegriffe vs. 3/8 without. --- whisper/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/whisper/main.py b/whisper/main.py index 121f34c..6325397 100644 --- a/whisper/main.py +++ b/whisper/main.py @@ -61,6 +61,7 @@ async def asr( output: str = Query("txt"), language: Optional[str] = Query(None), initial_prompt: Optional[str] = Form(None), + hotwords: Optional[str] = Form(None), ): suffix = os.path.splitext(audio_file.filename or "")[1] or ".bin" tmp = tempfile.NamedTemporaryFile(suffix=suffix, delete=False) @@ -85,6 +86,7 @@ async def asr( log_prob_threshold=-1.0, compression_ratio_threshold=2.4, initial_prompt=initial_prompt, + hotwords=hotwords, ) segments = list(segments_gen) infer_secs = time.monotonic() - t0