beyond commited on
Commit
c240e6a
1 Parent(s): 44213d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -14,9 +14,23 @@ def predict_zh(sketch):
14
  return generated_text
15
 
16
 
17
- gr.Interface(
18
- predict_zh,
19
- inputs=gr.inputs.Textbox(lines=7, placeholder='Input your sketch', label='Input'),
20
- outputs=gr.outputs.Label(num_top_classes=2),
21
- title="Sketch-based Text Generation",
22
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  return generated_text
15
 
16
 
17
+ with gr.Blocks() as demo:
18
+ gr.Markdown(
19
+ """
20
+ 💡GENIUS – generating text using sketches! [Visit our github repo](https://github.com/beyondguo/genius)
21
+ The English version use `<mask>` as the mask token.
22
+ """)
23
+
24
+ with gr.Row():
25
+ with gr.Column():
26
+ model_input = gr.Textbox(lines=7, placeholder='Input your sketch', label='Input')
27
+ with gr.Row():
28
+ gen = gr.Button("Generate")
29
+ clr = gr.Button("Clear")
30
+
31
+ outputs = gr.Textbox(lines=7, label='Output')
32
+
33
+ gen.click(fn=predict_zh, inputs=[model_input], outputs=outputs)
34
+ clr.click(fn=lambda value: gr.update(value=""), inputs=clr, outputs=model_input)
35
+
36
+ demo.launch()