Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 442 Bytes
f12accf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
def collapse_sidebar():
# return a config change for the Sidebar component
return gr.update(open=False)
with gr.Blocks() as demo:
with gr.Sidebar() as sidebar:
gr.Markdown("Sidebar content")
close_btn = gr.Button("Close sidebar")
# clicking the button tells Gradio to update the Sidebar's 'open' prop
close_btn.click(fn=collapse_sidebar, inputs=None, outputs=sidebar)
demo.launch()
|