Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from gtts import gTTS | |
| import os | |
| def text_to_speech(text): | |
| audio_file = "output.mp3" | |
| tts = gTTS(text, lang="es") | |
| tts.save(audio_file) | |
| return audio_file | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# Conversor de Texto a Voz (TTS) en Español") | |
| text_input = gr.Textbox(label="Escribe tu texto aquí") | |
| output_audio = gr.Audio(label="Salida de Audio") | |
| submit_btn = gr.Button("Generar Audio") | |
| submit_btn.click(fn=text_to_speech, inputs=text_input, outputs=output_audio) | |
| demo.launch() | |