Spaces:
Sleeping
Sleeping
drmurataltun
commited on
Commit
•
371ca08
1
Parent(s):
6ac9c1a
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
|
4 |
+
def change_textbox(choice):
|
5 |
+
if choice == "short":
|
6 |
+
return gr.Textbox(lines=2, visible=True)
|
7 |
+
elif choice == "long":
|
8 |
+
return gr.Textbox(lines=8, visible=True, value="Lorem ipsum dolor sit amet")
|
9 |
+
else:
|
10 |
+
return gr.Textbox(visible=False)
|
11 |
+
|
12 |
+
|
13 |
+
with gr.Blocks() as demo:
|
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, show_copy_button=True)
|
18 |
+
radio.change(fn=change_textbox, inputs=radio, outputs=text)
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
demo.launch()
|