File size: 631 Bytes
c8d06c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()