| import gradio as gr | |
| import random | |
| with gr.Blocks() as test: | |
| list_2 = ["choix21", "choix 22", "et choix 23"] | |
| with gr.Row(): | |
| with gr.Accordion("See Details") as grac: | |
| gr.Markdown("lorem ipsum") | |
| hide_btn = gr.Button("hide") | |
| show_btn = gr.Button("show") | |
| def hide_fn(): | |
| update_ = { | |
| grac: gr.update(open=False) | |
| } | |
| return update_ | |
| def show_fn(): | |
| update_ = { | |
| grac: gr.update(open=True) | |
| } | |
| return update_ | |
| hide_btn.click(hide_fn, | |
| inputs=[], | |
| outputs=[grac]) | |
| show_btn.click(show_fn, | |
| inputs=[], | |
| outputs=[grac]) | |
| if __name__ == "__main__": | |
| test.launch() | |