Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ def generate_and_speak(prompt):
|
|
10 |
generated_text = pipe(prompt, max_length=50, num_return_sequences=1)[0]["generated_text"]
|
11 |
|
12 |
# Placeholder: Simulating TTS (you can replace this with an actual TTS library)
|
13 |
-
# Install a TTS library such as gTTS for better implementation
|
14 |
from gtts import gTTS
|
15 |
tts = gTTS(generated_text, lang="bg")
|
16 |
audio_file = "output.mp3"
|
@@ -25,7 +24,7 @@ with gr.Blocks() as demo:
|
|
25 |
input_prompt = gr.Textbox(label="Enter a prompt in Bulgarian:")
|
26 |
with gr.Column():
|
27 |
output_text = gr.Textbox(label="Generated Text")
|
28 |
-
output_audio = gr.Audio(label="Generated Speech", type="file"
|
29 |
generate_button = gr.Button("Generate")
|
30 |
|
31 |
generate_button.click(generate_and_speak, inputs=input_prompt, outputs=[output_text, output_audio])
|
|
|
10 |
generated_text = pipe(prompt, max_length=50, num_return_sequences=1)[0]["generated_text"]
|
11 |
|
12 |
# Placeholder: Simulating TTS (you can replace this with an actual TTS library)
|
|
|
13 |
from gtts import gTTS
|
14 |
tts = gTTS(generated_text, lang="bg")
|
15 |
audio_file = "output.mp3"
|
|
|
24 |
input_prompt = gr.Textbox(label="Enter a prompt in Bulgarian:")
|
25 |
with gr.Column():
|
26 |
output_text = gr.Textbox(label="Generated Text")
|
27 |
+
output_audio = gr.Audio(label="Generated Speech", type="filepath") # Changed "file" to "filepath"
|
28 |
generate_button = gr.Button("Generate")
|
29 |
|
30 |
generate_button.click(generate_and_speak, inputs=input_prompt, outputs=[output_text, output_audio])
|