Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from gtts import gTTS
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
def text_to_speech(text):
|
| 6 |
+
audio_file = "output.mp3"
|
| 7 |
+
tts = gTTS(text, lang="es")
|
| 8 |
+
tts.save(audio_file)
|
| 9 |
+
return audio_file
|
| 10 |
+
|
| 11 |
+
with gr.Blocks() as demo:
|
| 12 |
+
gr.Markdown("# Conversor de Texto a Voz (TTS) en Español")
|
| 13 |
+
text_input = gr.Textbox(label="Escribe tu texto aquí")
|
| 14 |
+
output_audio = gr.Audio(label="Salida de Audio")
|
| 15 |
+
submit_btn = gr.Button("Generar Audio")
|
| 16 |
+
|
| 17 |
+
submit_btn.click(fn=text_to_speech, inputs=text_input, outputs=output_audio)
|
| 18 |
+
|
| 19 |
+
demo.launch()
|