File size: 1,376 Bytes
d42f4c5
 
ca97dd1
d42f4c5
ca97dd1
 
 
4b7632d
 
 
 
 
 
 
ffd211a
3409d90
766c020
4b7632d
 
 
ca97dd1
 
4a5727c
 
 
ca97dd1
 
 
 
 
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
import gradio as gr

fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech")

def text2speech(text):
    return fastspeech(text)
    
def engine(text_input):
    ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large")
    entities = ner(text_input)
    speech = text2speech(text_input)
    return entities, speech
    
app = gr.Interface(fn=engine, 
                   inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
                   #live=True,
                   description="Takes a text as input and reads it out to you.", 
                   outputs=[gr.outputs.Textbox(type="auto", label="Text"), gr.outputs.Audio(type="file", label="Speech Answer")],
                   examples=["On April 17th Sunday George celebrated Easter. He is staying at Empire State building with his parents. He is a citizen of Canada and speaks English and French fluently. His role model is former president Obama. He got 1000 dollar from his mother to visit Disney World and to buy new iPhone mobile.  George likes watching Game of Thrones."]
                   ).launch(debug=True)
                   
 
 #get_audio = gr.Button("generate audio")
 #get_audio.click(text2speech, inputs=text, outputs=speech)
 
#def greet(name):
#    return "Hello " + name + "!!"

#iface = gr.Interface(fn=greet, inputs="text", outputs="text")
#iface.launch()