aigmixer commited on
Commit
1782e10
1 Parent(s): 4492d6d

change to gradio blocks for interface.

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -26,16 +26,16 @@ def synthesize_speech(text):
26
 
27
  return audio_data.tobytes()
28
 
29
- # Create a Gradio interface with labels
30
- iface = gr.Interface(
31
- fn=synthesize_speech,
32
- inputs=gr.Textbox(label="Input Text"),
33
- outputs=[gr.Audio(label="Synthesized Speech")],
34
- title="Text to Speech Synthesizer",
35
- description="Enter text to synthesize it into speech using PiperVoice.",
36
- allow_flagging="never"
37
-
38
- )
39
 
40
  # Run the app
41
- iface.launch()
 
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()