File size: 1,099 Bytes
943ca21
080994c
03931e3
080994c
f13d5be
b17b983
 
080994c
 
 
b17b983
 
080994c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b17b983
f13d5be
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
26
27
28
29
30
31
32
33
34
import gradio as gr
from PIL import Image

STORE_MAP_FILE = "assets/store_map_clinicplus.png"

def reset_all():
    return (
        None, None, None, None, None, None, None,
        gr.update(choices=[], visible=False),
        "", {}, Image.open(STORE_MAP_FILE)
    )

with gr.Blocks() as demo:
    country = gr.Dropdown(choices=["A"], value="A")
    state = gr.Dropdown(choices=["B"], value="B")
    city = gr.Dropdown(choices=["C"], value="C")
    store = gr.Dropdown(choices=["D"], value="D")
    category = gr.Dropdown(choices=["E"], value="E")
    product = gr.Dropdown(choices=["F"], value="F")
    brand = gr.Dropdown(choices=["G"], value="G")
    quantity = gr.Dropdown(choices=["1"], value="1", visible=True)
    result = gr.Textbox("", lines=2)
    data_state = gr.State(value={"x": 1})
    store_map = gr.Image(value=Image.open(STORE_MAP_FILE), type="pil")
    reset_btn = gr.Button("Reset")

    reset_btn.click(
        reset_all,
        inputs=[],
        outputs=[country, state, city, store, category, product, brand, quantity, result, data_state, store_map]
    )

demo.launch()