This is a content-based movie recommendation system built with Python and FastAPI. It suggests movies similar to the one entered by the user based on metadata such as keywords, genres, cast, and director.
- ✅ Collected and preprocessed data from the TMDB 5000 movies and credits datasets.
- 🔄 Merged movies and credits CSV files on the movie title.
- 🧠 Extracted important features:
keywordsgenrestop 4 cast membersdirector
- 🏷 Combined these features into a single
tagscolumn for each movie. - ✨ Used
CountVectorizerto convert tags into feature vectors (max 5000 words, excluding stop words). - 📐 Calculated cosine similarity between movie vectors to measure closeness.
- 🔍 Built a function to recommend top N similar movies based on the input title.
- 🚀 Created a FastAPI backend with:
- Root endpoint (
/) - Recommendation endpoint (
/recommend?title=MovieName&top_n=5)
- Root endpoint (
- 🌐 Enabled CORS middleware to support frontend requests.
content_based.py: Contains data loading, preprocessing, and the recommendation logic.api.py: FastAPI server with defined endpoints and CORS settings.data/: Folder wheretmdb_5000_movies.csvandtmdb_5000_credits.csvshould be placed.