Skip to content

Commit 31974c5

Browse files
committed
fix: pre-commit
Signed-off-by: lishunyang <lishunyang12@163.com>
1 parent 1b42e4f commit 31974c5

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

examples/online_serving/qwen3_tts/gradio_demo.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,12 @@ def generate_speech(
108108

109109
elif task_type == "VoiceDesign":
110110
if not instructions or not instructions.strip():
111-
raise gr.Error(
112-
"VoiceDesign task requires voice style instructions."
113-
)
111+
raise gr.Error("VoiceDesign task requires voice style instructions.")
114112
payload["instructions"] = instructions.strip()
115113

116114
elif task_type == "Base":
117115
if ref_audio is None:
118-
raise gr.Error(
119-
"Base (voice clone) task requires reference audio."
120-
)
116+
raise gr.Error("Base (voice clone) task requires reference audio.")
121117
payload["ref_audio"] = encode_audio_to_base64(ref_audio)
122118
if ref_text and ref_text.strip():
123119
payload["ref_text"] = ref_text.strip()
@@ -136,10 +132,7 @@ def generate_speech(
136132
except httpx.TimeoutException:
137133
raise gr.Error("Request timed out. The server may be busy.")
138134
except httpx.ConnectError:
139-
raise gr.Error(
140-
f"Cannot connect to server at {api_base}. "
141-
"Make sure the vLLM server is running."
142-
)
135+
raise gr.Error(f"Cannot connect to server at {api_base}. Make sure the vLLM server is running.")
143136

144137
if resp.status_code != 200:
145138
raise gr.Error(f"Server error ({resp.status_code}): {resp.text}")
@@ -167,7 +160,7 @@ def on_task_type_change(task_type: str):
167160
"""Update UI visibility based on selected task type."""
168161
if task_type == "CustomVoice":
169162
return (
170-
gr.update(visible=True), # voice dropdown
163+
gr.update(visible=True), # voice dropdown
171164
gr.update(visible=True, info="Optional style/emotion instructions"),
172165
gr.update(visible=False), # ref_audio
173166
gr.update(visible=False), # ref_text
@@ -183,8 +176,8 @@ def on_task_type_change(task_type: str):
183176
return (
184177
gr.update(visible=False), # voice dropdown
185178
gr.update(visible=False), # instructions
186-
gr.update(visible=True), # ref_audio
187-
gr.update(visible=True), # ref_text
179+
gr.update(visible=True), # ref_audio
180+
gr.update(visible=True), # ref_text
188181
)
189182
return (
190183
gr.update(visible=True),
@@ -242,10 +235,7 @@ def build_interface(api_base: str):
242235
# Instructions (CustomVoice optional, VoiceDesign required)
243236
instructions = gr.Textbox(
244237
label="Instructions",
245-
placeholder=(
246-
"e.g., Speak with excitement / "
247-
"A warm, friendly female voice"
248-
),
238+
placeholder=("e.g., Speak with excitement / A warm, friendly female voice"),
249239
lines=2,
250240
visible=True,
251241
info="Optional style/emotion instructions",
@@ -332,9 +322,7 @@ def build_interface(api_base: str):
332322

333323

334324
def parse_args():
335-
parser = argparse.ArgumentParser(
336-
description="Gradio demo for Qwen3-TTS online serving."
337-
)
325+
parser = argparse.ArgumentParser(description="Gradio demo for Qwen3-TTS online serving.")
338326
parser.add_argument(
339327
"--api-base",
340328
default="http://localhost:8000",

0 commit comments

Comments
 (0)