mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
9b42ba8f10
* changes * changes * revert changes * changes * add changeset * notebooks script * changes * changes --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
20 lines
611 B
Python
20 lines
611 B
Python
import gradio as gr
|
|
|
|
def change_textbox(choice):
|
|
if choice == "short":
|
|
return gr.Textbox(lines=2, visible=True)
|
|
elif choice == "long":
|
|
return gr.Textbox(lines=8, visible=True, value="Lorem ipsum dolor sit amet")
|
|
else:
|
|
return gr.Textbox(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, show_copy_button=True)
|
|
radio.change(fn=change_textbox, inputs=radio, outputs=text)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|