audio-generator / app.py
ItzRoBeerT's picture
Rename proyecto1.py to app.py
8905a35 verified
raw
history blame
631 Bytes
import gradio as gr
from transformers import pipeline
import scipy
def getText(text):
return text
def say_something(text):
synthesiser = pipeline("text-to-speech", "suno/bark-small")
speech = synthesiser("Hello world!", forward_params={"do_sample": True})
scipy.io.wavfile.write("bark_out.wav", rate=speech["sampling_rate"], data=speech["audio"])
return "bark_out.wav"
with gr.Blocks() as demo:
textBox = gr.Textbox(label="Text")
button = gr.Button("Generate Speech")
audio_output = gr.Audio(label="Generated Speech")
button.click( say_something, outputs=[audio_output])
demo.launch()