Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
|
6 |
pipeline_zh = pipeline(task="text2text-generation", model="beyond/genius-base-chinese")
|
7 |
|
@@ -14,23 +14,23 @@ def predict_zh(sketch):
|
|
14 |
return generated_text
|
15 |
|
16 |
|
|
|
|
|
17 |
with gr.Blocks() as demo:
|
18 |
-
gr.Markdown(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
""
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
clr.click(fn=lambda value: gr.update(value=""), inputs=clr, outputs=model_input)
|
35 |
-
|
36 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
pipeline_en = pipeline(task="text2text-generation", model="beyond/genius-large")
|
5 |
|
6 |
pipeline_zh = pipeline(task="text2text-generation", model="beyond/genius-base-chinese")
|
7 |
|
|
|
14 |
return generated_text
|
15 |
|
16 |
|
17 |
+
|
18 |
+
|
19 |
with gr.Blocks() as demo:
|
20 |
+
gr.Markdown("We provide both English and Chinese GENIUS models.")
|
21 |
+
with gr.Tab("Enghlish"):
|
22 |
+
input1 = gr.Textbox(lines=5, placeholder="<mask> Conference on Empirical Methods <mask> submission of research papers <mask> Deep Learning <mask>")
|
23 |
+
output1 = gr.Textbox(lines=5)
|
24 |
+
button1 = gr.Button("Generate")
|
25 |
+
with gr.Tab("Chinese"):
|
26 |
+
input2 = gr.Textbox(lines=5, placeholder="自然语言处理[MASK]谷歌公司[MASK]通用人工智能[MASK]")
|
27 |
+
output2 = gr.Textbox(lines=5)
|
28 |
+
button2 = gr.Button("Generate")
|
29 |
+
|
30 |
+
# with gr.Accordion("Open for More!"):
|
31 |
+
# gr.Markdown("Look at me...")
|
32 |
+
|
33 |
+
button1.click(predict_en, inputs=input1, outputs=output1)
|
34 |
+
button2.click(predict_zh, inputs=input2, outputs=output2)
|
35 |
+
|
|
|
|
|
36 |
demo.launch()
|