yaoqi commited on
Commit
af240b0
1 Parent(s): 20671d2

Create app.py

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