Spaces:
Sleeping
Sleeping
Update ui/navigator_tab.py
Browse files- ui/navigator_tab.py +31 -0
ui/navigator_tab.py
CHANGED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from config import BASE_DIR
|
3 |
+
from utils.file_utils import get_subfolders, get_csv_files
|
4 |
+
from utils.data_utils import get_quantities_from_csv, display_quantity_info
|
5 |
+
|
6 |
+
def reset_all():
|
7 |
+
return (
|
8 |
+
None, None, None, None, None, None, None,
|
9 |
+
gr.update(choices=[], visible=False), "", {}
|
10 |
+
)
|
11 |
+
|
12 |
+
def create_navigator_tab():
|
13 |
+
with gr.TabItem("π§ Navigator"):
|
14 |
+
with gr.Row():
|
15 |
+
country = gr.Dropdown(label="π Country", choices=get_subfolders(BASE_DIR), interactive=True)
|
16 |
+
state = gr.Dropdown(label="π State", choices=[], interactive=True)
|
17 |
+
city = gr.Dropdown(label="π City", choices=[], interactive=True)
|
18 |
+
store = gr.Dropdown(label="πͺ Store", choices=[], interactive=True)
|
19 |
+
category = gr.Dropdown(label="π Category", choices=[], interactive=True)
|
20 |
+
product = gr.Dropdown(label="π¦ Product", choices=[], interactive=True)
|
21 |
+
brand = gr.Dropdown(label="π· Brand", choices=[], interactive=True)
|
22 |
+
quantity = gr.Dropdown(label="π’ Quantity", visible=False, interactive=True)
|
23 |
+
|
24 |
+
result = gr.Textbox(label="π Product Info", lines=5)
|
25 |
+
data_state = gr.State()
|
26 |
+
reset_btn = gr.Button("π Reset All")
|
27 |
+
|
28 |
+
# Chain dropdowns and bind logic here if needed
|
29 |
+
|
30 |
+
# Return all widgets as needed
|
31 |
+
return
|