felixz commited on
Commit
5fedb41
·
1 Parent(s): 078f905

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -25,7 +25,23 @@ def text2text(input_text):
25
  outputs = model.generate(input_ids, max_length=40)
26
  return tokenizer.decode(outputs[0])
27
 
28
- textin = gr.Textbox()
29
- examples = gr.Examples(examples=get_examples(), inputs=[textin])
30
- iface = gr.Interface(fn=text2text, inputs=[textin, examples], outputs="text")
31
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  outputs = model.generate(input_ids, max_length=40)
26
  return tokenizer.decode(outputs[0])
27
 
28
+
29
+ with gr.Blocks() as demo:
30
+
31
+ txt_in = gr.Textbox(label="Input", lines=2)
32
+ txt_out = gr.Textbox(value="", label="Output")
33
+
34
+
35
+ btn = gr.Button(value="Submit")
36
+ btn.click(text2text, inputs=[text_in], outputs=[txt_out])
37
+
38
+
39
+ gr.Examples(
40
+ examples=get_examples(),
41
+ inputs=[txt_in],
42
+ cache_examples=True
43
+ )
44
+
45
+
46
+ if __name__ == "__main__":
47
+ demo.launch()