awacke1 commited on
Commit
5d205bf
·
1 Parent(s): 42262aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -1,3 +1,22 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/bigscience/bloom").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ #gr.Interface.load("models/bigscience/bloom").launch()
4
+ api = gr.Interface.load("models/bigscience/bloom")
5
+
6
+ def change_textbox(choice, textin):
7
+ if choice == "short":
8
+ #return gr.Textbox.update(lines=2, visible=True)
9
+ elif choice == "long":
10
+ textin[:-50] + api(textin[-50:])
11
+ #return gr.Textbox.update(lines=8, visible=True)
12
+ else:
13
+ return gr.Textbox.update(visible=False)
14
+
15
+ with gr.Blocks() as block:
16
+ radio = gr.Radio(
17
+ ["short", "long", "none"], label="What kind of essay would you like to write?"
18
+ )
19
+ textin = gr.Textbox(lines=2, interactive=True)
20
+ textout = gr.Textbox(lines=2, interactive=True)
21
+ radio.change(fn=change_textbox, inputs=radio, textin, outputs=textout)
22
+ block.launch()