mirror of
https://github.com/R0m1k3/LiveFlow.git
synced 2026-10-11 17:27:19 +02:00
ASR : repli automatique sans le paramètre language refusé par certains moteurs
vLLM avec Qwen3-ASR peut répondre 400 quand 'language' est fourni. L'app retente alors en détection automatique, et les erreurs ASR remontent désormais avec le corps de la réponse pour faciliter le diagnostic. Ajout du favicon (404 dans la console). https://claude.ai/code/session_01YHMp3EKzr4s6o8w1ygxuUe
This commit is contained in:
2 files changed
+21
-7
No files matched your search
+20
-7
@@ -67,17 +67,30 @@ def pcm_to_wav(pcm: bytes) -> bytes:
|
||||
return buf.getvalue()
|
||||
|
||||
|
||||
async def transcribe(pcm: bytes) -> str:
|
||||
data = {"model": ASR_MODEL}
|
||||
if ASR_LANGUAGE:
|
||||
data["language"] = ASR_LANGUAGE
|
||||
resp = await http.post(
|
||||
async def _post_transcription(data: dict, wav: bytes) -> httpx.Response:
|
||||
return await http.post(
|
||||
f"{ASR_BASE_URL}/audio/transcriptions",
|
||||
headers={"Authorization": f"Bearer {ASR_API_KEY}"},
|
||||
data=data,
|
||||
files={"file": ("segment.wav", pcm_to_wav(pcm), "audio/wav")},
|
||||
files={"file": ("segment.wav", wav, "audio/wav")},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
|
||||
|
||||
async def transcribe(pcm: bytes) -> str:
|
||||
wav = pcm_to_wav(pcm)
|
||||
data = {"model": ASR_MODEL}
|
||||
if ASR_LANGUAGE:
|
||||
data["language"] = ASR_LANGUAGE
|
||||
resp = await _post_transcription(data, wav)
|
||||
if resp.status_code == 400 and "language" in data:
|
||||
# Certains moteurs (ex. Qwen3-ASR via vLLM) rejettent le paramètre
|
||||
# language : on retente en laissant la détection automatique.
|
||||
print(f"ASR a refusé language={ASR_LANGUAGE!r} ({resp.text[:200]}), "
|
||||
"nouvel essai sans ce paramètre", flush=True)
|
||||
del data["language"]
|
||||
resp = await _post_transcription(data, wav)
|
||||
if resp.status_code != 200:
|
||||
raise RuntimeError(f"ASR HTTP {resp.status_code} : {resp.text[:300]}")
|
||||
return resp.json().get("text", "").strip()
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LiveFlow — Transcription de réunions</title>
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%8E%99%EF%B8%8F%3C/text%3E%3C/svg%3E">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in new issue
Block a user