Robust language detection + anti-hallucination

- 3-sample voting for auto-detect (start/middle/end of song) prevents lang switching mid-song
- Lock detected language for full transcription
- Anti-hallucination: condition_on_previous_text=False, temperature=0.0
- compression_ratio_threshold=2.4 (rejects repetitive hallucinations)
- log_prob_threshold=-1.0 (rejects low-confidence segments)
- no_speech_threshold=0.6 (more aggressive silence detection)
- Default Whisper model changed: small → medium (better for all langs incl. Slavic)
This commit is contained in:
2026-04-29 07:59:20 +00:00
parent c870d80726
commit af3c933c78
3 changed files with 139 additions and 7 deletions
+7 -5
View File
@@ -231,11 +231,11 @@
<div>
<label>Whisper model</label>
<select id="model">
<option value="tiny">tiny (najhitrejši)</option>
<option value="tiny">tiny (najhitrejši, slabša natančnost)</option>
<option value="base">base</option>
<option value="small" selected>small (DE/EN, hitro)</option>
<option value="medium">medium (priporočeno za SLO/HR/BS)</option>
<option value="large-v3">large-v3 (najboljše, počasno)</option>
<option value="small">small (DE/EN, hitro)</option>
<option value="medium" selected>medium (privzeto, vsi jeziki)</option>
<option value="large-v3">large-v3 (najbolje, počasno)</option>
</select>
</div>
</div>
@@ -353,10 +353,12 @@
});
// ─── Auto-upgrade Whisper model za slovanske jezike ──
// Privzeto je medium; če uporabnik specifično izbere SLO/HR/BS in je na manjšem modelu, upgrade
$("#lang").addEventListener("change", e => {
const slavicLangs = ["sl", "hr", "bs", "sr"];
const currentModel = $("#model").value;
if (slavicLangs.includes(e.target.value) && (currentModel === "tiny" || currentModel === "base" || currentModel === "small")) {
const smallerModels = ["tiny", "base", "small"];
if (slavicLangs.includes(e.target.value) && smallerModels.includes(currentModel)) {
$("#model").value = "medium";
}
});