ysharma HF staff commited on
Commit
4b7632d
1 Parent(s): 766c020
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -5,13 +5,19 @@ fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech")
5
  def text2speech(text):
6
  return fastspeech(text)
7
 
8
-
9
- app = gr.Interface(fn=text2speech,
 
 
 
 
 
10
  inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
11
  #live=True,
12
  description="Takes a text as input and reads it out to you.",
13
- outputs=gr.outputs.Audio(type="file", label="Speech Answer"),
14
- 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)
 
15
 
16
 
17
  #get_audio = gr.Button("generate audio")
 
5
  def text2speech(text):
6
  return fastspeech(text)
7
 
8
+ def engine(text_input):
9
+ ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large")
10
+ entities = ner(text_input)
11
+ speech = text2speech(text_input)
12
+ return entities, speech
13
+
14
+ app = gr.Interface(fn=engine,
15
  inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
16
  #live=True,
17
  description="Takes a text as input and reads it out to you.",
18
+ outputs=[gr.outputs.Textbox(type="auto", label="Text"), gr.outputs.Audio(type="file", label="Speech Answer")],
19
+ 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."]
20
+ ).launch(debug=True)
21
 
22
 
23
  #get_audio = gr.Button("generate audio")