Type what you want in plain words, like "best gaming laptop under 80000" or "sasta phone", and ShopAI finds matching products, ranks them and scores the deals.
The live demo runs entirely in your browser with Pyodide; the first load takes a few seconds.
ShopAI is a Flask-based smart shopping platform that helps users search for products, get ranked recommendations, and find the best deals using a deal scoring system.
| Query | What ShopAI understands |
|---|---|
4k tv under 50000 |
TV category, 4K feature, budget up to ₹50,000 |
phone 15k-20k |
Phones between ₹15,000 and ₹20,000 |
noise cancelling earbuds |
Earbuds with noise cancellation (not the Noise brand) |
samsung tv |
Only Samsung TVs |
sony xm5 |
The exact Sony WF-1000XM5 model first |
sasta phone |
Phones sorted cheapest first |
mujhe 15000 ka phone chahiye |
Hinglish works too: phones up to ₹15,000 |
- Natural Language Search - Search products using plain queries like "best gaming laptop under 80000" or "phone above 20k"
- Smart Category & Brand Detection - Maps synonyms (e.g., "mobile", "smartphone", "head phones") to the right category with whole-word matching, and recognises brands, brand families (Mi → Redmi/POCO) and product lines (iPhone, MacBook)
- Budget Extraction - Understands "20k", "under 15000", "above 30000", "15k-20k", "between 10k and 20k", "around 25000" and "under 1.5L", and ignores spec numbers like "16gb" or "55 inch"
- Deal Score Engine - Ranks products using a formula based on discount percentage, rating, and customer sentiment
- Feature & Brand Matching - Matches queries against product brands, tags, and features (camera, battery, 5G, etc.)
- Conversational Responses - Handles identity questions, category browsing, and customer support queries in addition to product search
- Backend: Python, Flask
- Data Storage: JSON-based product database
- Frontend: HTML, CSS, JavaScript
ShoppingPro/
├── app.py # Flask app and API routes
├── assistant.py # Query handling shared by Flask and the browser demo
├── recommender.py # Search, category detection, and recommendation logic
├── deal_score.py # Deal score calculation engine
├── db_manager.py # Data access layer for products.json
├── products.json # Product database
├── index.html # GitHub Pages demo (same Python logic via Pyodide)
├── templates/
│ └── index.html # Main frontend page
└── static/
├── css/
└── js/
- Python 3.8 or higher
- pip
-
Clone the repository
git clone https://github.com/HIRA04IRSHAD/ShoppingPro.git cd ShoppingPro -
Install dependencies
pip install -r requirements.txt -
Run the application
python app.py -
Open your browser and go to
http://localhost:5000
- User submits a search query through the frontend
- The app checks for special intents (identity, support, categories) before running a product search
recommender.pyextracts category, budget, brand, and feature signals from the query- Matching products are scored and ranked using both a match score and a deal score
- Results are returned as JSON and rendered on the frontend
GitHub Pages can only serve static files, so the root index.html loads Pyodide (Python compiled to WebAssembly) and runs the same assistant.py, recommender.py, deal_score.py and db_manager.py in the browser. The Flask app and the demo share one copy of the logic.
python -m unittest discover -s tests
The tests cover budget parsing, category and brand detection, ranking and the Flask route.
Request body:
{
"query": "best gaming laptop under 80000"
}Response:
{
"status": "success",
"reply": "I found 5 matches for you. Sorting them by the best deals!",
"products": [ ... ],
"type": "search"
}This project is for academic purposes.