Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
| 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() | |