Spaces:
Sleeping
Sleeping
change to gradio blocks for interface.
Browse files
app.py
CHANGED
|
@@ -26,16 +26,16 @@ def synthesize_speech(text):
|
|
| 26 |
|
| 27 |
return audio_data.tobytes()
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
)
|
| 39 |
|
| 40 |
# Run the app
|
| 41 |
-
|
|
|
|
| 26 |
|
| 27 |
return audio_data.tobytes()
|
| 28 |
|
| 29 |
+
# Using Gradio Blocks
|
| 30 |
+
|
| 31 |
+
with gr.Blocks(theme=gr.themes.Base()) as blocks:
|
| 32 |
+
gr.Markdown("# Text to Speech Synthesizer")
|
| 33 |
+
gr.Markdown("Enter text to synthesize it into speech using PiperVoice.")
|
| 34 |
+
input_text = gr.Textbox(label="Input Text")
|
| 35 |
+
output_audio = gr.Audio(label="Synthesized Speech", type="numpy")
|
| 36 |
+
submit_button = gr.Button("Synthesize")
|
| 37 |
+
|
| 38 |
+
submit_button.click(synthesize_speech, inputs=input_text, outputs=output_audio)
|
| 39 |
|
| 40 |
# Run the app
|
| 41 |
+
blocks.launch()
|