Spaces:
Runtime error
Runtime error
riabayonaor
commited on
Commit
•
9100ef3
1
Parent(s):
59898ad
Update app.py
Browse files
app.py
CHANGED
@@ -1,35 +1,31 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
-
import
|
4 |
-
import scipy.io.wavfile
|
5 |
-
import numpy as np
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
processor = AutoTokenizer.from_pretrained(model_name)
|
11 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
iface = gr.Interface(
|
28 |
-
fn=text_to_speech,
|
29 |
-
inputs="text",
|
30 |
-
outputs=[gr.Textbox(), gr.File()],
|
31 |
-
title="Spanish Text-to-Speech",
|
32 |
-
description="Convert text to speech in Spanish using the facebook/tts_transformer-es-css10 model."
|
33 |
-
)
|
34 |
-
|
35 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from tts import synthesize, TTS_LANGUAGES
|
3 |
+
import base64
|
|
|
|
|
4 |
|
5 |
+
# Definir la función de síntesis
|
6 |
+
def synthesize_audio(text, speed, language):
|
7 |
+
return synthesize(text, speed, language)
|
|
|
|
|
8 |
|
9 |
+
# Crear la interfaz con Gradio
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
gr.Markdown(
|
12 |
+
"""
|
13 |
+
<center>
|
14 |
+
<h1>Uso de AI para la generación de audio a partir de texto.</h1>
|
15 |
+
<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>
|
16 |
+
</center>
|
17 |
+
"""
|
18 |
+
)
|
19 |
+
with gr.Row():
|
20 |
+
with gr.Column():
|
21 |
+
leng = gr.Radio(choices=["spa","eng"], value="spa", label="Selecciona un idioma entre Inglés (eng) y Español (spa)")
|
22 |
+
textbox = gr.Textbox(label="Ingrese texto")
|
23 |
+
slider = gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Velocidad de voz")
|
24 |
+
button = gr.Button("Hablar")
|
25 |
+
with gr.Column():
|
26 |
+
audio_output = gr.Audio()
|
27 |
+
file_output = gr.File(label="Descargar audio")
|
28 |
+
|
29 |
+
button.click(synthesize_audio, [textbox, slider, leng], [audio_output, file_output])
|
30 |
|
31 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|