Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,14 +69,14 @@ with gr.Blocks(title="RetailGenie Navigator") as demo:
|
|
69 |
gr.Markdown("## π§ RetailGenie β Multi-Store Smart Inventory Assistant")
|
70 |
|
71 |
with gr.Row():
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
|
81 |
result = gr.Textbox(label="π Product Info", lines=5)
|
82 |
data_state = gr.State()
|
@@ -85,37 +85,37 @@ with gr.Blocks(title="RetailGenie Navigator") as demo:
|
|
85 |
|
86 |
# Logic: Chain each dropdown to the next
|
87 |
country.change(
|
88 |
-
lambda c: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c)), value=None),
|
89 |
inputs=country,
|
90 |
outputs=state
|
91 |
)
|
92 |
|
93 |
state.change(
|
94 |
-
lambda c, s: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s)), value=None),
|
95 |
inputs=[country, state],
|
96 |
outputs=city
|
97 |
)
|
98 |
|
99 |
city.change(
|
100 |
-
lambda c, s, ci: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s, ci)), value=None),
|
101 |
inputs=[country, state, city],
|
102 |
outputs=store
|
103 |
)
|
104 |
|
105 |
store.change(
|
106 |
-
lambda c, s, ci, st: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s, ci, st)), value=None),
|
107 |
inputs=[country, state, city, store],
|
108 |
outputs=category
|
109 |
)
|
110 |
|
111 |
category.change(
|
112 |
-
lambda c, s, ci, st, cat: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s, ci, st, cat)), value=None),
|
113 |
inputs=[country, state, city, store, category],
|
114 |
outputs=product
|
115 |
)
|
116 |
|
117 |
product.change(
|
118 |
-
lambda c, s, ci, st, cat, prod: gr.update(choices=get_csv_files(os.path.join(BASE_DIR, c, s, ci, st, cat, prod)), value=None),
|
119 |
inputs=[country, state, city, store, category, product],
|
120 |
outputs=brand
|
121 |
)
|
|
|
69 |
gr.Markdown("## π§ RetailGenie β Multi-Store Smart Inventory Assistant")
|
70 |
|
71 |
with gr.Row():
|
72 |
+
country = gr.Dropdown(label="π Country", choices=get_subfolders(BASE_DIR), value=None)
|
73 |
+
state = gr.Dropdown(label="ποΈ State", choices=[], visible=True, interactive=False)
|
74 |
+
city = gr.Dropdown(label="ποΈ City", choices=[], visible=True, interactive=False)
|
75 |
+
store = gr.Dropdown(label="πͺ Store", choices=[], visible=True, interactive=False)
|
76 |
+
category = gr.Dropdown(label="ποΈ Category", choices=[], visible=True, interactive=False)
|
77 |
+
product = gr.Dropdown(label="π¦ Product", choices=[], visible=True, interactive=False)
|
78 |
+
brand = gr.Dropdown(label="π·οΈ Brand", choices=[], visible=True, interactive=False)
|
79 |
+
quantity = gr.Dropdown(label="π’ Quantity", visible=False)
|
80 |
|
81 |
result = gr.Textbox(label="π Product Info", lines=5)
|
82 |
data_state = gr.State()
|
|
|
85 |
|
86 |
# Logic: Chain each dropdown to the next
|
87 |
country.change(
|
88 |
+
lambda c: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c)), value=None,interactive=True),
|
89 |
inputs=country,
|
90 |
outputs=state
|
91 |
)
|
92 |
|
93 |
state.change(
|
94 |
+
lambda c, s: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s)), value=None, interactive=True),
|
95 |
inputs=[country, state],
|
96 |
outputs=city
|
97 |
)
|
98 |
|
99 |
city.change(
|
100 |
+
lambda c, s, ci: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s, ci)), value=None, interactive=True),
|
101 |
inputs=[country, state, city],
|
102 |
outputs=store
|
103 |
)
|
104 |
|
105 |
store.change(
|
106 |
+
lambda c, s, ci, st: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s, ci, st)), value=None, interactive=True),
|
107 |
inputs=[country, state, city, store],
|
108 |
outputs=category
|
109 |
)
|
110 |
|
111 |
category.change(
|
112 |
+
lambda c, s, ci, st, cat: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c, s, ci, st, cat)), value=None, interactive=True),
|
113 |
inputs=[country, state, city, store, category],
|
114 |
outputs=product
|
115 |
)
|
116 |
|
117 |
product.change(
|
118 |
+
lambda c, s, ci, st, cat, prod: gr.update(choices=get_csv_files(os.path.join(BASE_DIR, c, s, ci, st, cat, prod)), value=None, interactive=True),
|
119 |
inputs=[country, state, city, store, category, product],
|
120 |
outputs=brand
|
121 |
)
|