File size: 460 Bytes
f1c5c38
 
 
 
 
 
 
cd1ce33
f1c5c38
 
 
47322e4
893d4cd
f1c5c38
 
 
893d4cd
f1c5c38
893d4cd
 
f1c5c38
 
 
 
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
import time

import gradio as gr


def init_choices():
    t = time.gmtime(time.time())
    return ["a", "b", f"{t.tm_min}:{t.tm_sec}"]


with gr.Blocks() as demo:
    dropdown = gr.Dropdown(label="Select", multiselect=True, choices=["a0", "b0"])
    state = gr.State()

    demo.load(
        fn=init_choices,
        outputs=state,
    ).then(
        fn=lambda x: gr.Dropdown(choices=x),
        inputs=state,
        outputs=dropdown,
    )

demo.launch()