mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-03 01:50:59 +08:00
8b1a50775a
* tweaks + radio fix * remove unused prop * revert demo * ensure table renders empty strings and zeroes * remove logs * remove bundle stats
23 lines
576 B
Python
23 lines
576 B
Python
import gradio as gr
|
|
|
|
|
|
def change_textbox(choice):
|
|
if choice == "short":
|
|
return gr.Textbox.update(lines=2, visible=True)
|
|
elif choice == "long":
|
|
return gr.Textbox.update(lines=8, visible=True)
|
|
else:
|
|
return gr.Textbox.update(visible=False)
|
|
|
|
|
|
with gr.Blocks() as demo:
|
|
radio = gr.Radio(
|
|
["short", "long", "none"], label="What kind of essay would you like to write?"
|
|
)
|
|
text = gr.Textbox(lines=2, interactive=True)
|
|
|
|
radio.change(fn=change_textbox, inputs=radio, outputs=text)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|