This demo extends your original Flask app to support multiple users and personalized recommendations based on items they like. It blends semantic search (Sentence‑BERT) with a user taste profile (mean of liked‑item embeddings).
- User accounts (super simple JSON store) + login/logout
- “Like” button on every product card
- Personalized feed from your likes
- Hybrid ranking:
combined = α * search + (1-α) * user_profile - Nice Bootstrap UI with nav + profile page
RecoTrack/
main.py
templates/
base.html
login.html
index.html
profile.html
product_embeddings.pkl # <-- place your file here
user_db.json # auto‑created on first run
pip install flask sentence-transformers pandas numpyCopy your existing product_embeddings.pkl into the reco_app/ folder next to main.py.
Expected columns in the dataframe:
title(str)brand(str)category(str)embeddings(array/list of floats)imgs(optional) list of image URLs or a stringified list (we parse safely)
If id is missing, we will create one automatically.
cd reco_app
python main.py- Login as
user1oruser2(or make a new username). - Use the search box (e.g., “wireless earbuds”). Move the slider to adjust the blend between search and personalization.
- Click Like on a few items. Your Home feed becomes personalized.
- Check My Likes to see what you’ve saved. You can clear likes there.
- User profile = mean of normalized embeddings of liked products.
- Search vector = normalized embedding of your query.
- Hybrid = normalize(
α * search_vec + (1-α) * user_vec). - We compute cosine similarity with all items and show the top results, excluding items you already liked so you keep discovering new things.
- This is a demo using a JSON file as a “DB”. Move to SQLite/Postgres for production.
- Replace
APP_SECRET_KEYwith a strong secret for real deployments. - Template/UI kept simple; customize as needed.