mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
da05e59a53
* changes
* add changeset
* changes
* changes
* Update many-tips-create.md
* notebooks
* chanegs
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changew
* changes
* changes
* changes
* changes
* chanegs
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* changes
* Revert "changes"
This reverts commit 0868c25c56
.
* changes
* changes
* changes
* changes
* changes
* changes
* change
* changes
* chaneges
* changes
* chagnes
* changes
* changes
* changes
* changes
* changes
* fix typing
* changes
---------
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
23 lines
614 B
Python
23 lines
614 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()
|