File size: 1,154 Bytes
17e27a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os


###### FACEBOOK
#from mms import generate_audio_mms
from tts import synthesize, TTS_LANGUAGES
import torch
import base64

with open("Iso_Logotipo_Ceibal.png", "rb") as image_file:
    encoded_image = base64.b64encode(image_file.read()).decode()


import gradio as gr
with gr.Blocks() as demo:

  gr.Markdown(
    """
    <center>
    <h1>
    Uso de AI para la generación de audio a partir de texto.
    </h1>
    <img src='data:image/jpg;base64,{}' width=200px>
    <h3>
    Con este espacio podrás producir audio que lee el texto de entrada. Podrás ajustar la velocidad con a la que habla el modelo.
    </h3>
    </center>
    """.format(encoded_image))
  with gr.Row():
    with gr.Column():
      leng = gr.Radio(choices=["spa","eng"], value="spa",label="Seleccioná 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()



    button.click(synthesize,[textbox,slider,leng],audio_output)
demo.launch()