albertvillanova's picture
Update app.py
71f5eaa verified
raw
history blame
601 Bytes
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"])
dropdown2 = gr.Dropdown(label="Select", multiselect=True)
state = gr.State()
demo.load(
fn=init_choices,
outputs=state,
)
demo.launch()
"""
demo.load(
fn=init_choices,
outputs=state,
).then(
fn=lambda x: gr.Dropdown(choices=x),
inputs=state,
outputs=dropdown,
)
"""