Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -8,14 +8,20 @@ def text2speech(text):
|
|
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 |
|
|
|
8 |
def engine(text_input):
|
9 |
ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large")
|
10 |
entities = ner(text_input)
|
11 |
+
entities = [tupl for tupl in entities if None not in tupl]
|
12 |
+
entities_num = len(entities)
|
13 |
+
|
14 |
+
img = gr.Interface.load("spaces/multimodalart/latentdiffusion", inputs=[entities[0],50,256,256,1,10], title="Convert text to image")
|
15 |
+
|
16 |
speech = text2speech(text_input)
|
17 |
+
return entities, speech, img
|
18 |
|
19 |
app = gr.Interface(fn=engine,
|
20 |
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
|
21 |
#live=True,
|
22 |
description="Takes a text as input and reads it out to you.",
|
23 |
+
outputs=[gr.outputs.Textbox(type="auto", label="Text"), gr.outputs.Audio(type="file", label="Speech Answer"),
|
24 |
+
gr.outputs.Image(type="file", label="Speech Answer")],
|
25 |
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."]
|
26 |
).launch(debug=True)
|
27 |
|