gradio/demo/blocks_essay_simple/run.py
aliabid94 da05e59a53
Removing .update and get_config, attempt 2 (#5240)
* 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>
2023-09-18 21:17:06 -07:00

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()