A Machine Learning powered Content-Based Movie Recommendation System built using Streamlit, Scikit-Learn and TMDb API.
The Movie Recommendation System is an interactive Machine Learning web application that recommends movies similar to a user's selected movie using Content-Based Filtering.
The recommendation engine analyzes movie genres using TF-IDF Vectorization and computes similarity scores using Cosine Similarity to identify movies with similar content.
To provide a richer user experience, the application integrates the TMDb API to fetch:
- π¬ Movie Posters
- β TMDb Ratings
- π Release Dates
- π Movie Overview
- π Original Language
- π₯ Popularity Score
- π³ Vote Count
The application is developed using Streamlit, providing a modern, responsive, and interactive web interface.
- Content-Based Recommendation System
- TF-IDF Vectorization
- Cosine Similarity
- Top-N Similar Movie Recommendations
- Movie Posters
- Movie Overview
- Release Date
- TMDb Rating
- Original Language
- Popularity
- Vote Count
- Average User Rating
- Modern Dark Theme
- Interactive Streamlit Dashboard
- Responsive Layout
- Sidebar Statistics
- Recommendation Cards
- Similarity Progress Bar
- Genre Badges
- Movie Search
- Professional UI Design
- Cached TMDb API Calls
- Session State Management
- Error Handling
- Missing Poster Fallback
- Fast Recommendation Retrieval
This project uses the MovieLens Latest Small Dataset.
| Dataset | Count |
|---|---|
| Movies | 9,742 |
| Users | 610 |
| Ratings | 100,836 |
| Tags | 3,683+ |
Dataset includes:
- Movies
- Ratings
- Tags
- TMDb Links
Movie Dataset
β
βΌ
Data Preprocessing
β
βΌ
Genre Extraction
β
βΌ
TF-IDF Vectorization
β
βΌ
Cosine Similarity Matrix
β
βΌ
Top Similar Movies
β
βΌ
TMDb API
β
βΌ
Interactive Streamlit Dashboard
The recommendation pipeline consists of the following steps:
- User selects a movie.
- Movie genres are converted into TF-IDF vectors.
- Cosine similarity is computed between movies.
- Top similar movies are selected.
- Movie metadata is fetched from TMDb.
- Recommendations are displayed with posters and ratings.
| Category | Technology |
|---|---|
| Programming Language | Python |
| Machine Learning | Scikit-Learn |
| Data Processing | Pandas, NumPy |
| Web Framework | Streamlit |
| API | TMDb API |
| Model Serialization | Joblib |
| Visualization | Matplotlib |
Movie_Recommendation_System/
β
βββ app/
β βββ app.py
βββ dataset/
β βββ movies.csv
β βββ ratings.csv
β βββ links.csv
β βββ tags.csv
βββ model/
β βββ cosine_similarity.pkl
β βββ movie_indices.pkl
β βββ movies.pkl
βββ notebooks/
β βββ movie_recommendation.ipynb
βββ output/
β βββ Home Page.png
β βββ Selected Movie.png
β βββ Recommendations.png
β βββ average_rating_distribution.png
β βββ genre_distribution.png
β βββ rating_distribution.png
β βββ ratings_per_movie.png
β βββ ratings_per_user.png
β βββ top_rated_movies.png
β βββ top_users.png
βββ requirements.txt
βββ README.md
βββ .gitignore
β Successfully recommends similar movies.
β Real-time movie posters using TMDb.
β Displays ratings, release dates and overview.
β Professional interactive dashboard.
β Supports more than 9,700 movies.
β Average response time below 2 seconds after caching.
Clone the repository
git clone https://github.com/YOUR_USERNAME/Movie_Recommendation_System.gitNavigate to project folder
cd Movie_Recommendation_SystemCreate virtual environment
python -m venv .venvActivate virtual environment
.venv\Scripts\activatesource .venv/bin/activateInstall dependencies
pip install -r requirements.txtCreate a folder named:
.streamlit
Create a file:
secrets.toml
Add your TMDb credentials:
TMDB_API_KEY="YOUR_API_KEY"
TMDB_BEARER_TOKEN="YOUR_BEARER_TOKEN"streamlit run app/app.py- Verify your TMDb API credentials.
- Check your internet connection.
- Ensure
tmdbIdexists for the selected movie.
Verify that the following files exist:
movies.pkl
movie_indices.pkl
cosine_similarity.pkl
The first TMDb request may take longer.
Subsequent requests are cached automatically.
- Hybrid Recommendation System
- Collaborative Filtering
- Deep Learning Recommendation Model
- Personalized Recommendations
- User Authentication
- Favorite Movies
- Watchlist
- Movie Trailer Integration
- Actor & Director Information
- Genre & Year Filters
- Deploy on Streamlit Community Cloud
Through this project, I gained practical experience in:
- Machine Learning Recommendation Systems
- TF-IDF Vectorization
- Cosine Similarity
- Content-Based Filtering
- Data Preprocessing
- API Integration
- Streamlit Application Development
- Session State Management
- Model Serialization
- Interactive Dashboard Design
B.Tech Computer Science & Engineering
SRM Institute of Science and Technology
https://www.linkedin.com/in/connect-harsh-vardhan
GitHub
https://github.com/harshvardhan4096
If you found this project useful, consider giving this repository a β on GitHub.
It motivates me to build and share more Machine Learning and AI projects.
This project is licensed under the MIT License.









