Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -180,24 +180,31 @@ def build_ui():
|
|
| 180 |
with gr.Tab("CustomVoice", id="customvoice"): pass
|
| 181 |
with gr.Tab("Podcast", id="podcast"): pass
|
| 182 |
|
|
|
|
| 183 |
# --- 第二行 Tab:选择模型后端 ---
|
| 184 |
model_selection = gr.State(qwen3tts_name)
|
| 185 |
with gr.Tabs(elem_classes="model-tabs") as model_tabs:
|
| 186 |
with gr.Tab(qwen3tts_name, id=qwen3tts_name): pass
|
| 187 |
with gr.Tab(soulx_name, id=soulx_name): pass
|
| 188 |
-
|
| 189 |
-
# --- 监听
|
| 190 |
-
# mode_tabs.select(fn=lambda x: x, inputs=None, outputs=mode_selection, show_progress=False)
|
| 191 |
-
# model_tabs.select(fn=lambda x: x, inputs=None, outputs=model_selection, show_progress=False)
|
| 192 |
-
|
| 193 |
-
# 提取 ID 的函数
|
| 194 |
def on_select(evt: gr.SelectData):
|
|
|
|
| 195 |
return evt.value
|
| 196 |
|
| 197 |
-
# 监听第一行 Tab
|
| 198 |
-
mode_tabs.select(
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
gr.Markdown("---")
|
| 203 |
|
|
@@ -257,6 +264,19 @@ def build_ui():
|
|
| 257 |
text, lang, model_size, speaker, instruct,
|
| 258 |
s1_wav, s1_txt, s2_wav, s2_txt, seed
|
| 259 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
# 1. 判断是否是 Podcast 模式 (两人都有音频)
|
| 261 |
if mode == "podcast":
|
| 262 |
assert s1_wav and s2_wav
|
|
@@ -290,8 +310,6 @@ def build_ui():
|
|
| 290 |
# --- 按钮绑定 ---
|
| 291 |
def clear_output():
|
| 292 |
return None, "⏳ Analysis in progress... deciding mode..."
|
| 293 |
-
print(mode_selection, model_selection, shared_text, shared_language, shared_model_size, tts_speaker, design_instruct,
|
| 294 |
-
spk1_ref_audio, spk1_ref_text, spk2_ref_audio, spk2_ref_text, seed_input)
|
| 295 |
|
| 296 |
generate_btn.click(
|
| 297 |
fn=clear_output,
|
|
|
|
| 180 |
with gr.Tab("CustomVoice", id="customvoice"): pass
|
| 181 |
with gr.Tab("Podcast", id="podcast"): pass
|
| 182 |
|
| 183 |
+
|
| 184 |
# --- 第二行 Tab:选择模型后端 ---
|
| 185 |
model_selection = gr.State(qwen3tts_name)
|
| 186 |
with gr.Tabs(elem_classes="model-tabs") as model_tabs:
|
| 187 |
with gr.Tab(qwen3tts_name, id=qwen3tts_name): pass
|
| 188 |
with gr.Tab(soulx_name, id=soulx_name): pass
|
| 189 |
+
|
| 190 |
+
# --- 核心监听函数 ---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
def on_select(evt: gr.SelectData):
|
| 192 |
+
print(f"DEBUG: Selected -> {evt.value}") # 方便你在控制台查看是否切换成功
|
| 193 |
return evt.value
|
| 194 |
|
| 195 |
+
# 监听第一行 Tab:更新模式状态
|
| 196 |
+
mode_tabs.select(
|
| 197 |
+
fn=on_select,
|
| 198 |
+
inputs=None,
|
| 199 |
+
outputs=mode_selection
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
# 监听第二行 Tab:更新模型名称状态 (注意 outputs 指向 model_selection)
|
| 203 |
+
model_tabs.select(
|
| 204 |
+
fn=on_select,
|
| 205 |
+
inputs=None,
|
| 206 |
+
outputs=model_selection
|
| 207 |
+
)
|
| 208 |
|
| 209 |
gr.Markdown("---")
|
| 210 |
|
|
|
|
| 264 |
text, lang, model_size, speaker, instruct,
|
| 265 |
s1_wav, s1_txt, s2_wav, s2_txt, seed
|
| 266 |
):
|
| 267 |
+
# --- 调试打印区 ---
|
| 268 |
+
print("="*30)
|
| 269 |
+
print(f"【Mode Selected】: {mode}")
|
| 270 |
+
print(f"【Model Selected】: {model_name}")
|
| 271 |
+
print(f"【Target Text】: {text}")
|
| 272 |
+
print(f"【Language】: {lang}")
|
| 273 |
+
print(f"【Speaker】: {speaker}")
|
| 274 |
+
print(f"【Style Instruct】: {instruct}")
|
| 275 |
+
print(f"【SPK1 Audio Path】: {s1_wav}")
|
| 276 |
+
print(f"【SPK1 Text】: {s1_txt}")
|
| 277 |
+
print(f"【Seed】: {seed}")
|
| 278 |
+
print("="*30)
|
| 279 |
+
|
| 280 |
# 1. 判断是否是 Podcast 模式 (两人都有音频)
|
| 281 |
if mode == "podcast":
|
| 282 |
assert s1_wav and s2_wav
|
|
|
|
| 310 |
# --- 按钮绑定 ---
|
| 311 |
def clear_output():
|
| 312 |
return None, "⏳ Analysis in progress... deciding mode..."
|
|
|
|
|
|
|
| 313 |
|
| 314 |
generate_btn.click(
|
| 315 |
fn=clear_output,
|