File size: 550 Bytes
953bac0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr

def change_textbox(choice):
    if choice == "short":
        return gr.Textbox.update(lines=20, visible=True)
    elif choice == "long":
        return gr.Textbox.update(lines=80, visible=True)
    else:
        return gr.Textbox.update(visible=False)

with gr.Blocks() as block:
    radio = gr.Radio(
        ["short", "long", "none"], label="What kind of essay would you like to write?"
    )
    text = gr.Textbox(lines=20, interactive=True)

    radio.change(fn=change_textbox, inputs=radio, outputs=text)
    block.launch()