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