Spaces:
Sleeping
Sleeping
Update product_recommendation.py
Browse files
product_recommendation.py
CHANGED
|
@@ -5,8 +5,8 @@ def get_category_from_message(message):
|
|
| 5 |
"""Extract category from user message"""
|
| 6 |
categories = {
|
| 7 |
'book': 'Books', 'electronic': 'Electronics', 'cloth': 'Clothing',
|
| 8 |
-
'fashion': 'Clothing', 'furniture': 'Furniture', 'furnitur': 'Furniture',
|
| 9 |
-
'toy': 'Toys', 'sport': 'Sports', 'beauty': 'Beauty', 'beauti': 'Beauty',
|
| 10 |
'grocer': 'Groceries'
|
| 11 |
}
|
| 12 |
for key, value in categories.items():
|
|
@@ -47,7 +47,7 @@ def handle_recommendation_flow(message, state):
|
|
| 47 |
recs = recommend_products("personalized", mobile_number=mobile)
|
| 48 |
return format_recommendations(recs)
|
| 49 |
else:
|
| 50 |
-
return "I couldn't find any purchase history for that mobile number.
|
| 51 |
elif _check_keywords(message, ['personalized', 'personal', 'specialized', 'specialization', 'customized', 'custom']):
|
| 52 |
return "Great! Please provide your mobile number so I can give you personalized recommendations based on your purchase history."
|
| 53 |
elif _check_keywords(message, ['popular']):
|
|
|
|
| 5 |
"""Extract category from user message"""
|
| 6 |
categories = {
|
| 7 |
'book': 'Books', 'electronic': 'Electronics', 'cloth': 'Clothing',
|
| 8 |
+
'fashion': 'Clothing', 'furniture': 'Furniture', 'furnitur': 'Furniture',
|
| 9 |
+
'toy': 'Toys', 'sport': 'Sports', 'beauty': 'Beauty', 'beauti': 'Beauty',
|
| 10 |
'grocer': 'Groceries'
|
| 11 |
}
|
| 12 |
for key, value in categories.items():
|
|
|
|
| 47 |
recs = recommend_products("personalized", mobile_number=mobile)
|
| 48 |
return format_recommendations(recs)
|
| 49 |
else:
|
| 50 |
+
return "I couldn't find any purchase history for that mobile number. Please enter the correct 10-digit mobile number to get personalized recommendations."
|
| 51 |
elif _check_keywords(message, ['personalized', 'personal', 'specialized', 'specialization', 'customized', 'custom']):
|
| 52 |
return "Great! Please provide your mobile number so I can give you personalized recommendations based on your purchase history."
|
| 53 |
elif _check_keywords(message, ['popular']):
|