An interactive Movie Recommendation System built using Machine Learning and Streamlit, enhanced with real-time data from the TMDB API.
This app suggests similar movies based on user selection and displays rich details like posters, genres, release date, and overview.
✅ Content-based movie recommendation
✅ Dynamic number of recommendations (5, 10, 15, 20)
✅ Beautiful Netflix-style UI
✅ Movie posters from TMDB API
✅ Expandable movie overview
✅ Genre & release date display
✅ Responsive full-width layout
✅ API loading spinner for better UX
The system uses a Content-Based Filtering approach:
-
Movies are represented using features like:
- Genres
- Keywords
- Cast
- Crew
-
These features are combined into a single text representation.
-
Using vectorization (CountVectorizer) and cosine similarity, we compute similarity scores between movies.
-
Based on the selected movie, the system:
- Finds similar movies
- Fetches additional details via TMDB API
- Displays results in UI
- Frontend/UI: Streamlit
- Backend: Python
- Machine Learning: Scikit-learn
- Data Processing: Pandas, NumPy
- API: TMDB (The Movie Database)
movie-recommender/
│
├── app.py # Main Streamlit app
├── movies.pkl # Preprocessed movie data
├── similarity.pkl # Similarity matrix
├── requirements.txt # Dependencies
├── .streamlit/
│ └── secrets.toml # API keys (not committed)
└── README.md
git clone https://github.com/your-username/movie-recommender.git
cd movie-recommenderpython -m venv venv
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a file:
.streamlit/secrets.toml
Add:
TMDB_API_KEY = "your_api_key_here"🔑 Get API key from: https://www.themoviedb.org/settings/api
streamlit run app.py-
Select a movie from the dropdown
-
Choose number of recommendations
-
Click "Recommend"
-
View results with:
- Poster 🎞️
- Title 🎬
- Release Date 📅
- Genres 🎭
- Overview 📖
- API calls cached using
@st.cache_data - Reduced UI blocking with loading spinner
- Optimized layout using Streamlit columns
- API keys stored in
.streamlit/secrets.toml - Sensitive files excluded via
.gitignore
- 🎥 Movie trailer integration (YouTube)
- ⭐ Ratings & popularity score
- 🤖 AI-based "Why this recommendation?"
- 🔍 Search autocomplete
- 🌐 Deploy on Streamlit Cloud / Azure
- Learning ML recommendation systems
- Hackathons & demos
- Portfolio project
Contributions are welcome!
- Fork the repo
- Create a new branch
- Make changes
- Submit a PR
This project is open-source and available under the MIT License.
If you like this project, give it a ⭐ on GitHub!

