Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -110,7 +110,7 @@ VOICES: Dict[str, str] = {
|
|
110 |
|
111 |
def text_to_speech(text: str, voice: str) -> str:
|
112 |
"""Wrapper function to run async code"""
|
113 |
-
return asyncio.run(generate_speech(text, voice))
|
114 |
|
115 |
def get_languages() -> list:
|
116 |
"""Extract unique languages from voice names"""
|
@@ -167,11 +167,10 @@ with gr.Blocks(title="Multi-Voice Text-to-Speech", theme="soft") as demo:
|
|
167 |
with gr.Column():
|
168 |
audio_output = gr.Audio(label="Generated Speech", autoplay=True)
|
169 |
download_btn = gr.DownloadButton(
|
170 |
-
|
171 |
-
|
172 |
)
|
173 |
|
174 |
-
|
175 |
# Interactive components
|
176 |
language_filter.change(
|
177 |
update_voice_dropdown,
|
@@ -179,12 +178,11 @@ with gr.Blocks(title="Multi-Voice Text-to-Speech", theme="soft") as demo:
|
|
179 |
outputs=voice_dropdown
|
180 |
)
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
|
189 |
audio_output.change(
|
190 |
lambda: gr.DownloadButton.update(visible=True),
|
|
|
110 |
|
111 |
def text_to_speech(text: str, voice: str) -> str:
|
112 |
"""Wrapper function to run async code"""
|
113 |
+
return asyncio.run(generate_speech(text, VOICES[voice])) # Modified to use VOICES[voice]
|
114 |
|
115 |
def get_languages() -> list:
|
116 |
"""Extract unique languages from voice names"""
|
|
|
167 |
with gr.Column():
|
168 |
audio_output = gr.Audio(label="Generated Speech", autoplay=True)
|
169 |
download_btn = gr.DownloadButton(
|
170 |
+
label="Download Audio",
|
171 |
+
visible=False
|
172 |
)
|
173 |
|
|
|
174 |
# Interactive components
|
175 |
language_filter.change(
|
176 |
update_voice_dropdown,
|
|
|
178 |
outputs=voice_dropdown
|
179 |
)
|
180 |
|
181 |
+
generate_btn.click(
|
182 |
+
text_to_speech,
|
183 |
+
inputs=[text_input, voice_dropdown],
|
184 |
+
outputs=[audio_output, download_btn]
|
185 |
+
)
|
|
|
186 |
|
187 |
audio_output.change(
|
188 |
lambda: gr.DownloadButton.update(visible=True),
|