Spaces:
Running
Running
Commit
·
87bb320
1
Parent(s):
a2d405c
update app.py for gradio 6 compat
Browse files
app.py
CHANGED
|
@@ -31,11 +31,13 @@ def synthesize_speech(text):
|
|
| 31 |
buffer.seek(0)
|
| 32 |
audio_data = np.frombuffer(buffer.read(), dtype=np.int16)
|
| 33 |
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
# Using Gradio Blocks
|
| 38 |
-
|
|
|
|
| 39 |
gr.Markdown("# Text to Speech Synthesizer")
|
| 40 |
gr.Markdown("Enter text to synthesize it into speech using PiperVoice.")
|
| 41 |
input_text = gr.Textbox(label="Input Text")
|
|
@@ -50,4 +52,4 @@ with gr.Blocks(theme=gr.themes.Base()) as blocks:
|
|
| 50 |
)
|
| 51 |
|
| 52 |
# Run the app
|
| 53 |
-
blocks.launch()
|
|
|
|
| 31 |
buffer.seek(0)
|
| 32 |
audio_data = np.frombuffer(buffer.read(), dtype=np.int16)
|
| 33 |
|
| 34 |
+
# In Gradio 6, Audio with type="numpy" expects a tuple of (sample_rate, audio_array)
|
| 35 |
+
return (voice.config.sample_rate, audio_data), None
|
| 36 |
|
| 37 |
|
| 38 |
# Using Gradio Blocks
|
| 39 |
+
# In Gradio 6, theme moved from Blocks() constructor to launch()
|
| 40 |
+
with gr.Blocks() as blocks:
|
| 41 |
gr.Markdown("# Text to Speech Synthesizer")
|
| 42 |
gr.Markdown("Enter text to synthesize it into speech using PiperVoice.")
|
| 43 |
input_text = gr.Textbox(label="Input Text")
|
|
|
|
| 52 |
)
|
| 53 |
|
| 54 |
# Run the app
|
| 55 |
+
blocks.launch(theme="base")
|