Spaces:
Running
Running
File size: 1,609 Bytes
9d075d8 8e1207a 9d075d8 8e1207a 9d075d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import gradio as gr
def greet(name):
return "Hello " + name + "!"
with gr.Blocks() as demo:
with gr.Tabs():
with gr.TabItem("Tab 1"):
t = gr.Textbox("Some value", label="Name", visible=False, interactive=True)
with gr.Row():
show_btn = gr.Button("Show")
show_btn.click(lambda: gr.Textbox(visible=True), inputs=None, outputs=t)
hide_btn = gr.Button("Hide")
hide_btn.click(lambda: gr.Textbox(visible=False), inputs=None, outputs=t)
with gr.TabItem("Tab 2"):
t2 = gr.Textbox(
"Some other value", label="Name", visible=False, interactive=True
)
with gr.Row():
show_btn2 = gr.Button("Show")
show_btn2.click(
lambda: gr.Textbox(visible=True), inputs=None, outputs=t2
)
hide_btn2 = gr.Button("Hide")
hide_btn2.click(
lambda: gr.Textbox(visible=False), inputs=None, outputs=t2
)
with gr.TabItem("Tab 3"):
t3 = gr.ImageEditor(label="Name", visible=False, interactive=True)
with gr.Row():
show_btn3 = gr.Button("Show")
show_btn3.click(
lambda: gr.Textbox(visible=True), inputs=None, outputs=t3
)
hide_btn3 = gr.Button("Hide")
hide_btn3.click(
lambda: gr.Textbox(visible=False), inputs=None, outputs=t3
)
if __name__ == "__main__":
demo.launch()
|