Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,8 @@ def synthesize_speech(text):
|
|
55 |
wav_file.setnchannels(1) # mono
|
56 |
|
57 |
# Synthesize speech
|
58 |
-
|
|
|
59 |
|
60 |
# Convert buffer to NumPy array for Gradio output
|
61 |
buffer.seek(0)
|
@@ -69,9 +70,9 @@ with gr.Blocks(theme=gr.themes.Base()) as blocks:
|
|
69 |
gr.Markdown("Enter text to synthesize it into speech using PiperVoice.")
|
70 |
input_text = gr.Textbox(label="Input Text")
|
71 |
output_audio = gr.Audio(label="Synthesized Speech", type="numpy")
|
|
|
72 |
submit_button = gr.Button("Synthesize")
|
73 |
|
74 |
-
submit_button.click(synthesize_speech, inputs=input_text, outputs=[output_audio])
|
75 |
-
|
76 |
# Run the app
|
77 |
blocks.launch()
|
|
|
55 |
wav_file.setnchannels(1) # mono
|
56 |
|
57 |
# Synthesize speech
|
58 |
+
eztext = preprocess_text(text)
|
59 |
+
voice.synthesize(eztext, wav_file)
|
60 |
|
61 |
# Convert buffer to NumPy array for Gradio output
|
62 |
buffer.seek(0)
|
|
|
70 |
gr.Markdown("Enter text to synthesize it into speech using PiperVoice.")
|
71 |
input_text = gr.Textbox(label="Input Text")
|
72 |
output_audio = gr.Audio(label="Synthesized Speech", type="numpy")
|
73 |
+
output_text = gr.Textbox(label="Output Text", visible=False) # This is the new text output component
|
74 |
submit_button = gr.Button("Synthesize")
|
75 |
|
76 |
+
submit_button.click(synthesize_speech, inputs=input_text, outputs=[output_audio, output_text])
|
|
|
77 |
# Run the app
|
78 |
blocks.launch()
|