ysharma HF staff commited on
Commit
1ebdc35
1 Parent(s): e922fdf

create app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -0
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech")
4
+
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
+ #entities = [tupl for tupl in entities if None not in tupl]
12
+ #entities_num = len(entities)
13
+
14
+ #img = run(text_input,'50','256','256','1',10) #entities[0][0]
15
+
16
+ img_intfc = gr.Interface.load("spaces/multimodalart/latentdiffusion")
17
+ #img_intfc = gr.Interface.load("spaces/multimodalart/latentdiffusion", inputs=[gr.inputs.Textbox(lines=1, label="Input Text"), gr.inputs.Textbox(lines=1, label="Input Text"), gr.inputs.Textbox(lines=1, label="Input Text"), gr.inputs.Textbox(lines=1, label="Input Text"), gr.inputs.Textbox(lines=1, label="Input Text"), gr.inputs.Textbox(lines=1, label="Input Text")],
18
+ #outputs=[gr.outputs.Image(type="pil", label="output image"),gr.outputs.Carousel(label="Individual images",components=["image"]),gr.outputs.Textbox(label="Error")], )
19
+ #title="Convert text to image")
20
+ #img = img_intfc[0]
21
+ img = img_intfc('George','50','256','256','1',10)
22
+ #img = img[0]
23
+ #inputs=['George',50,256,256,1,10]
24
+ #run(prompt, steps, width, height, images, scale)
25
+
26
+ #speech = text2speech(text_input)
27
+ return img #entities, speech, img
28
+
29
+ app = gr.Interface(fn=engine,
30
+ inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
31
+ #live=True,
32
+ description="Takes a text as input and reads it out to you.",
33
+ outputs=[#gr.outputs.Textbox(type="auto", label="Text"),gr.outputs.Audio(type="file", label="Speech Answer"),
34
+ gr.outputs.Image(type="pil", label="output image")],
35
+ examples = ['Apple']
36
+ #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."]
37
+ ).launch(enable_queue=True) #(debug=True)
38
+
39
+
40
+ #get_audio = gr.Button("generate audio")
41
+ #get_audio.click(text2speech, inputs=text, outputs=speech)
42
+
43
+ #def greet(name):
44
+ # return "Hello " + name + "!!"
45
+
46
+ #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
47
+ #iface.launch()