Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,11 +60,26 @@ def docx_to_wav(doc_file, selected_voice, selected_speaker=None):
|
|
60 |
|
61 |
def show_load_button(voice_selection):
|
62 |
info = VOICE_MODELS[voice_selection]
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
def load_and_show_speakers(voice_selection):
|
66 |
speakers = extract_speakers(voice_selection)
|
67 |
-
return
|
|
|
|
|
|
|
|
|
68 |
|
69 |
with gr.Blocks() as interface:
|
70 |
gr.Markdown("# 🎤 Realistic Voiceover from DOCX\nUpload a `.docx` file, select a voice, and generate lifelike speech!")
|
|
|
60 |
|
61 |
def show_load_button(voice_selection):
|
62 |
info = VOICE_MODELS[voice_selection]
|
63 |
+
if info["multi_speaker"]:
|
64 |
+
return (
|
65 |
+
gr.update(visible=True), # Show "Load Speakers"
|
66 |
+
gr.update(visible=False), # Hide speaker dropdown until loaded
|
67 |
+
gr.update(interactive=False) # Disable generate button
|
68 |
+
)
|
69 |
+
else:
|
70 |
+
return (
|
71 |
+
gr.update(visible=False), # Hide "Load Speakers"
|
72 |
+
gr.update(visible=False), # Hide speaker dropdown
|
73 |
+
gr.update(interactive=True) # Enable generate button for single speaker
|
74 |
+
)
|
75 |
|
76 |
def load_and_show_speakers(voice_selection):
|
77 |
speakers = extract_speakers(voice_selection)
|
78 |
+
return (
|
79 |
+
gr.update(choices=speakers, visible=True, value=speakers[0]),
|
80 |
+
gr.update(interactive=True) # Now enable the generate button
|
81 |
+
)
|
82 |
+
|
83 |
|
84 |
with gr.Blocks() as interface:
|
85 |
gr.Markdown("# 🎤 Realistic Voiceover from DOCX\nUpload a `.docx` file, select a voice, and generate lifelike speech!")
|