Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,8 @@ class SmartShoppingAssistant:
|
|
| 29 |
def setup_agent(self):
|
| 30 |
def search_products(query):
|
| 31 |
try:
|
| 32 |
-
if '
|
| 33 |
-
self.df['
|
| 34 |
results = self.df.query(query)
|
| 35 |
return results.to_string() if not results.empty else "No products found matching your criteria."
|
| 36 |
except Exception as e:
|
|
@@ -107,7 +107,7 @@ def main():
|
|
| 107 |
|
| 108 |
@st.cache_data
|
| 109 |
def load_product_data():
|
| 110 |
-
return pd.read_csv('
|
| 111 |
|
| 112 |
df = load_product_data()
|
| 113 |
assistant = SmartShoppingAssistant(df)
|
|
|
|
| 29 |
def setup_agent(self):
|
| 30 |
def search_products(query):
|
| 31 |
try:
|
| 32 |
+
if 'RetailPrice' in self.df.columns:
|
| 33 |
+
self.df['RetailPrice'] = pd.to_numeric(self.df['RetailPrice'].str.replace('$', ''), errors='coerce')
|
| 34 |
results = self.df.query(query)
|
| 35 |
return results.to_string() if not results.empty else "No products found matching your criteria."
|
| 36 |
except Exception as e:
|
|
|
|
| 107 |
|
| 108 |
@st.cache_data
|
| 109 |
def load_product_data():
|
| 110 |
+
return pd.read_csv('supermarket2.csv')
|
| 111 |
|
| 112 |
df = load_product_data()
|
| 113 |
assistant = SmartShoppingAssistant(df)
|