Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from tts import synthesize, TTS_LANGUAGES | |
| import base64 | |
| # Definir la función de síntesis | |
| def synthesize_audio(text, speed, language): | |
| return synthesize(text, speed, language) | |
| # Crear la interfaz con Gradio | |
| with gr.Blocks() as demo: | |
| gr.Markdown( | |
| """ | |
| <center> | |
| <h1>Uso de AI para la generación de audio a partir de texto.</h1> | |
| <h3>Con este espacio podrás producir audio que lee el texto de entrada. Podrás ajustar la velocidad con la que habla el modelo.</h3> | |
| </center> | |
| """ | |
| ) | |
| with gr.Row(): | |
| with gr.Column(): | |
| leng = gr.Radio(choices=["spa","eng"], value="spa", label="Selecciona un idioma entre Inglés (eng) y Español (spa)") | |
| textbox = gr.Textbox(label="Ingrese texto") | |
| slider = gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Velocidad de voz") | |
| button = gr.Button("Hablar") | |
| with gr.Column(): | |
| audio_output = gr.Audio() | |
| file_output = gr.File(label="Descargar audio") | |
| button.click(synthesize_audio, [textbox, slider, leng], [audio_output, file_output]) | |
| demo.launch() |