Skip to content

muhammadahmedraza12/RecoTrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI‑Powered Product Recommender (Search + Personalization)

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).

What’s new

  • 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

Project Structure

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

1) Install

pip install flask sentence-transformers pandas numpy

2) Put your data

Copy 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.

3) Run

cd reco_app
python main.py

Open http://localhost:5000/

4) Try it

  1. Login as user1 or user2 (or make a new username).
  2. Use the search box (e.g., “wireless earbuds”). Move the slider to adjust the blend between search and personalization.
  3. Click Like on a few items. Your Home feed becomes personalized.
  4. Check My Likes to see what you’ve saved. You can clear likes there.

How recommendations work

  • 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.

Notes

  • This is a demo using a JSON file as a “DB”. Move to SQLite/Postgres for production.
  • Replace APP_SECRET_KEY with a strong secret for real deployments.
  • Template/UI kept simple; customize as needed.

About

RecoTrack is a Flask-based product recommendation system that personalizes results using user interactions, search queries, and selected interests. It manages real-time user data in JSON, tracks login sessions via cookies and extracts product details from CSV to generate hybrid recommendations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors