File size: 456 Bytes
f1c5c38
 
 
 
 
 
 
cd1ce33
f1c5c38
 
 
 
9cb3444
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 = gr.State()

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

demo.launch()