A powerful backend system that delivers personalized and category-based motivational video recommendations using deep learning and hybrid recommendation models.
- Personalized content recommendation based on user interactions.
- Handles cold-start problem using mood/category-based filtering.
- Hybrid approach using collaborative filtering + content-based embeddings.
- SBERT embeddings for user and post representation.
- Daily caching of embeddings and interaction data.
- Integrates with Empowerverse and Socialverse APIs.
- Backend: FastAPI
- ML: SentenceTransformers (SBERT), FAISS, ALS (implicit)
- Data: Pandas, Scikit-learn
- API Testing: Postman
-
User Embeddings: Text features from bio, role, and user type encoded using SBERT; numerical features scaled with MinMaxScaler.
-
Post Embeddings: Metadata (title, topic, slug, and post summary) embedded using SBERT.
-
Hybrid Model:
- Collaborative Filtering: Using Implicit ALS on user-post interactions.
- Content-Based Filtering: Using SBERT and FAISS for semantic similarity.
- Blended Score: Combines both methods with weighted fusion to rank posts.
-
Caching:
- Daily caching of embeddings and interactions in
cache/usingpickle. - Avoids recomputation unless the day changes.
- Daily caching of embeddings and interactions in
-
Data Fetching:
- Fetches views, likes, inspires, ratings, users, and posts from the Socialverse API.
-
Serving Layer:
- FastAPI serves endpoints and resolves usernames to user_ids.
- Embeddings are used to generate feed responses in real time.
video-recommendation-engine/
├── app/
│ ├── routes/
│ │ └── feed.py # FastAPI endpoint logic
│ └── main.py # FastAPI entry point
├── model.py # Hybrid recommendation model + embedding logic
├── cache/ # Stores pickled embeddings, DataFrames, and cache date
├── requirements.txt # Python dependencies
├── .env # Environment variables (not committed)
├── README.md
└── empowerverse_postman_collection.json # Postman demo requests
- Python 3.8+
- Virtual environment (recommended)
git clone https://github.com/Tim-Alpha/video-recommendation-assignment.git
cd video-recommendation-engine
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the root directory:
FLIC_TOKEN=your_flic_token
API_BASE_URL=https://api.socialverseapp.com
uvicorn app.main:app --reloadThen open: http://127.0.0.1:8000/docs
Get Personalized Feed
GET /feed?username=<username>
Get Category-based Feed
GET /feed?username=<username>&project_code=<project_code>
All requests to Socialverse API use:
"Flic-Token": "your_flic_token"