Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,6 +43,7 @@ def display_quantity_info(quantity, data_dict):
|
|
43 |
f"β’ Aisle: {row['Aisle']}\n"
|
44 |
f"β’ Price: βΉ{row['Price']}"
|
45 |
)
|
|
|
46 |
if "Offer" in row and pd.notna(row["Offer"]) and row["Offer"].strip():
|
47 |
msg += f"\nβ’ π Offer: {row['Offer']}"
|
48 |
return msg
|
@@ -74,7 +75,7 @@ def suggest_items(query):
|
|
74 |
def reset_all():
|
75 |
return (
|
76 |
None, None, None, None, None, None, None,
|
77 |
-
gr.update(choices=[], visible=False), "", {}
|
78 |
)
|
79 |
|
80 |
# Interface
|
@@ -98,17 +99,6 @@ with gr.Blocks(title="RetailGenie") as demo:
|
|
98 |
data_state = gr.State()
|
99 |
reset_btn = gr.Button("π Reset All")
|
100 |
|
101 |
-
# Store Map Section
|
102 |
-
map_label = gr.Markdown("πΊοΈ **Store Map (Click to Expand)**")
|
103 |
-
map_display = gr.Image("assets/store_map_clinicplus.png", elem_id="map-preview", show_label=False, interactive=False)
|
104 |
-
expand_btn = gr.Button("π View Full Map")
|
105 |
-
full_map = gr.Image("assets/store_map_clinicplus.png", visible=False, show_label=False)
|
106 |
-
|
107 |
-
def show_full_map():
|
108 |
-
return gr.update(visible=True)
|
109 |
-
|
110 |
-
expand_btn.click(show_full_map, outputs=full_map)
|
111 |
-
|
112 |
# Dropdown chain logic
|
113 |
country.change(
|
114 |
lambda c: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c)) if c else [], value=None, interactive=True),
|
@@ -155,7 +145,7 @@ with gr.Blocks(title="RetailGenie") as demo:
|
|
155 |
)
|
156 |
|
157 |
quantity.change(display_quantity_info, inputs=[quantity, data_state], outputs=result)
|
158 |
-
reset_btn.click(reset_all, inputs=[], outputs=[country, state, city, store, category, product, brand, quantity, result, data_state
|
159 |
|
160 |
# π Suggestions Tab
|
161 |
with gr.TabItem("π Smart Suggestions"):
|
|
|
43 |
f"β’ Aisle: {row['Aisle']}\n"
|
44 |
f"β’ Price: βΉ{row['Price']}"
|
45 |
)
|
46 |
+
# Show only Offer field if it exists and is not empty
|
47 |
if "Offer" in row and pd.notna(row["Offer"]) and row["Offer"].strip():
|
48 |
msg += f"\nβ’ π Offer: {row['Offer']}"
|
49 |
return msg
|
|
|
75 |
def reset_all():
|
76 |
return (
|
77 |
None, None, None, None, None, None, None,
|
78 |
+
gr.update(choices=[], visible=False), "", {}
|
79 |
)
|
80 |
|
81 |
# Interface
|
|
|
99 |
data_state = gr.State()
|
100 |
reset_btn = gr.Button("π Reset All")
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
# Dropdown chain logic
|
103 |
country.change(
|
104 |
lambda c: gr.update(choices=get_subfolders(os.path.join(BASE_DIR, c)) if c else [], value=None, interactive=True),
|
|
|
145 |
)
|
146 |
|
147 |
quantity.change(display_quantity_info, inputs=[quantity, data_state], outputs=result)
|
148 |
+
reset_btn.click(reset_all, inputs=[], outputs=[country, state, city, store, category, product, brand, quantity, result, data_state])
|
149 |
|
150 |
# π Suggestions Tab
|
151 |
with gr.TabItem("π Smart Suggestions"):
|