File size: 735 Bytes
97ed57b
 
cd7c74d
 
 
 
a96c24f
cd7c74d
 
 
 
 
 
 
 
e37c345
cd7c74d
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr

advanced_button = gr.Button("Advanced options", elem_id="advanced-btn")
css = '''
#advanced-options {display: none}
'''
block = gr.Blocks(css=css)
with block:
    advanced_button = gr.Button("Advanced options", elem_id="advanced-btn")
    with gr.Row(elem_id="advanced-options"):
        samples = gr.Slider(label="Images", minimum=1, maximum=4, value=3, step=1)

    advanced_button.click(
        None,
        [],
        [],
        _js="""
        () => {
            const options = document.querySelector("body > gradio-app").shadowRoot.querySelector("#advanced-options");
            options.style.display = ["none", ""].includes(options.style.display) ? "flex" : "none";
        }""",
    )
block.launch()