Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -399,7 +399,85 @@ with gr.Blocks() as app_tts:
|
|
399 |
with gr.Blocks() as app_multistyle:
|
400 |
gr.Markdown("# Multiple Speech-Type Generation")
|
401 |
# ... [Keep original multistyle interface unchanged] ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
# ========== REST OF ORIGINAL CODE (UNCHANGED BELOW) ========== #
|
404 |
# [Main app configuration, other tabs (TTS, Multistyle, Chat, Credits)]
|
405 |
# [Keep all original code after this point exactly as it was]
|
|
|
399 |
with gr.Blocks() as app_multistyle:
|
400 |
gr.Markdown("# Multiple Speech-Type Generation")
|
401 |
# ... [Keep original multistyle interface unchanged] ...
|
402 |
+
with gr.Blocks() as app_chat:
|
403 |
+
gr.Markdown("# Voice Chat")
|
404 |
+
# ... [Keep original voice chat interface unchanged] ...
|
405 |
+
|
406 |
+
with gr.Blocks() as app:
|
407 |
+
gr.Markdown(f"""
|
408 |
+
# E2/F5 TTS
|
409 |
+
{"Local web UI for [F5 TTS](https://github.com/SWivid/F5-TTS)" if not USING_SPACES else "Online demo for [F5-TTS](https://github.com/SWivid/F5-TTS)"}
|
410 |
+
""")
|
411 |
+
|
412 |
+
with gr.Row():
|
413 |
+
if not USING_SPACES:
|
414 |
+
choose_tts_model = gr.Radio(
|
415 |
+
choices=[DEFAULT_TTS_MODEL, "E2-TTS", "Custom"],
|
416 |
+
label="TTS Model",
|
417 |
+
value=DEFAULT_TTS_MODEL
|
418 |
+
)
|
419 |
+
else:
|
420 |
+
choose_tts_model = gr.Radio(
|
421 |
+
choices=[DEFAULT_TTS_MODEL, "E2-TTS"],
|
422 |
+
label="TTS Model",
|
423 |
+
value=DEFAULT_TTS_MODEL
|
424 |
+
)
|
425 |
+
|
426 |
+
custom_ckpt_path = gr.Dropdown(
|
427 |
+
choices=[DEFAULT_TTS_MODEL_CFG[0]],
|
428 |
+
value=load_last_used_custom()[0],
|
429 |
+
allow_custom_value=True,
|
430 |
+
label="Model Path",
|
431 |
+
visible=False
|
432 |
+
)
|
433 |
+
custom_vocab_path = gr.Dropdown(
|
434 |
+
choices=[DEFAULT_TTS_MODEL_CFG[1]],
|
435 |
+
value=load_last_used_custom()[1],
|
436 |
+
allow_custom_value=True,
|
437 |
+
label="Vocab Path",
|
438 |
+
visible=False
|
439 |
+
)
|
440 |
+
custom_model_cfg = gr.Dropdown(
|
441 |
+
choices=[DEFAULT_TTS_MODEL_CFG[2]],
|
442 |
+
value=load_last_used_custom()[2],
|
443 |
+
allow_custom_value=True,
|
444 |
+
label="Model Config",
|
445 |
+
visible=False
|
446 |
+
)
|
447 |
+
|
448 |
+
choose_tts_model.change(
|
449 |
+
switch_tts_model,
|
450 |
+
inputs=[choose_tts_model],
|
451 |
+
outputs=[custom_ckpt_path, custom_vocab_path, custom_model_cfg]
|
452 |
+
)
|
453 |
+
|
454 |
+
gr.TabbedInterface(
|
455 |
+
[app_tts, app_podcast, app_multistyle, app_chat, app_credits],
|
456 |
+
["Basic TTS", "Podcast", "Multi-Style", "Voice Chat", "Credits"],
|
457 |
+
)
|
458 |
|
459 |
+
@click.command()
|
460 |
+
@click.option("--port", "-p", default=None, type=int)
|
461 |
+
@click.option("--host", "-H", default=None)
|
462 |
+
@click.option("--share", "-s", default=True, is_flag=True)
|
463 |
+
@click.option("--api", "-a", default=True, is_flag=True)
|
464 |
+
@click.option("--root_path", "-r", default=None)
|
465 |
+
def main(port, host, share, api, root_path):
|
466 |
+
global app
|
467 |
+
print("Launching app...")
|
468 |
+
app.queue(api_open=api).launch(
|
469 |
+
server_name=host,
|
470 |
+
server_port=port,
|
471 |
+
share=share,
|
472 |
+
show_api=api,
|
473 |
+
root_path=root_path
|
474 |
+
)
|
475 |
+
|
476 |
+
if __name__ == "__main__":
|
477 |
+
if not USING_SPACES:
|
478 |
+
main()
|
479 |
+
else:
|
480 |
+
app.queue().launch()
|
481 |
# ========== REST OF ORIGINAL CODE (UNCHANGED BELOW) ========== #
|
482 |
# [Main app configuration, other tabs (TTS, Multistyle, Chat, Credits)]
|
483 |
# [Keep all original code after this point exactly as it was]
|