File size: 508 Bytes
f6bbb30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr

from coqui_tts import CoquiTTS


def speech(text, audio):
    coqui_tts = CoquiTTS(speaker_wave_file = audio)
    return coqui_tts.speech_text_and_save_it(text, "output.wav")


interface = gr.Interface(
    fn = speech,
    inputs = [gr.Textbox(placeholder = "Your text to speech here"),
              gr.Audio(sources = ["microphone"], type = "filepath")],
    outputs = [gr.Audio(label = "File path")]
    , allow_flagging = "never")

if __name__ == '__main__':
    interface.launch()