[Bugfix] Fix Qwen3-TTS gradio streaming TTFP by using audio/pcm (#4346)

Signed-off-by: YU Xinyuan <yuxinyuan02@corp.netease.com>
Co-authored-by: YU Xinyuan <yuxinyuan02@corp.netease.com>
Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-06-12 03:19:48 +00:00
1 parent a3834e32cf
commit 541f06c60d
1 file changed
+4 -1
@@ -408,7 +408,10 @@ def create_app(api_base: str):
await resp.aclose()
await client.aclose()
return StreamingResponse(relay(), media_type="application/octet-stream")
# Use audio/pcm to bypass browsers (e.g. Chromium) MIME type sniffing, which
# buffers application/octet-stream responses before delivering chunks to
# fetch().body.getReader(), inflating TTFP to total_ms.
return StreamingResponse(relay(), media_type="audio/pcm")
# ── Gradio UI ────────────────────────────────────────────────
voices = fetch_voices(api_base)