Skip to content

Commit 7cb7b3e

Browse files
Fix Qwen3-TTS gradio demo (vllm-project#2372)
Signed-off-by: noobhappylife <aratar1991@hotmail.com>
1 parent de1ac5e commit 7cb7b3e

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

examples/online_serving/qwen3_tts/gradio_demo.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class TTSPlaybackProcessor extends AudioWorkletProcessor {
125125
def _build_player_js(sample_rate: int) -> str:
126126
"""Build the JavaScript that powers the AudioWorklet player."""
127127
return f"""
128-
() => {{
128+
<script>
129129
const SR = {sample_rate};
130130
const WC = {json.dumps(WORKLET_JS)};
131131
let ctx = null, node = null, abort = null, gen = false, st = {{}};
@@ -284,7 +284,7 @@ def _build_player_js(sample_rate: int) -> str:
284284
}}
285285
}}
286286
}};
287-
}}
287+
</script>
288288
"""
289289

290290

@@ -435,10 +435,7 @@ async def relay():
435435
)
436436

437437
with gr.Blocks(
438-
css=css,
439438
title="Qwen3-TTS Demo",
440-
js=_build_player_js(PCM_SAMPLE_RATE),
441-
theme=theme,
442439
) as demo:
443440
gr.HTML(f"""
444441
<div style="display:flex; align-items:center; gap:16px; margin-bottom:8px;">
@@ -773,7 +770,14 @@ def on_generate(stream_enabled, *args):
773770

774771
demo.queue()
775772

776-
return gr.mount_gradio_app(fastapi_app, demo, path="/")
773+
return gr.mount_gradio_app(
774+
fastapi_app,
775+
demo,
776+
path="/",
777+
css=css,
778+
theme=theme,
779+
head=_build_player_js(PCM_SAMPLE_RATE),
780+
)
777781

778782

779783
def parse_args():

examples/online_serving/qwen3_tts/tts_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def build_payload(
103103

104104
if task_type == "CustomVoice":
105105
if voice:
106-
payload["speaker"] = voice
106+
payload["voice"] = voice
107107
if instructions and instructions.strip():
108108
payload["instructions"] = instructions.strip()
109109

0 commit comments

Comments
 (0)