This project is a content based recommender system which calculates the similarity matrix of 4805 movies in the TMDB database using cosine similarity. It then gives top 5 recommendations based on highest similarity scores (between -1 and 1)
Project link - Streamlit Cloud project
If the above link doesn't work, then please follow the instructions given below from here to setup the project in your system.
- The 2 .csv files in the dataset were merged
- All important columns were retained
- Transformations using functions were performed to convert all column values to lists
- The columns were merged to create a "tags" column
- Transformations like lowercase, stemming, removing stopwords was done on the "tags" column
- Cosine similarity matrix was calculated and a "recommend_movie" function was created to recommend the movies
- A PyCharm project was created with a virtual environment
- movies.pkl and similarity.pkl files were generated from the .ipynb file itself and copied to the PyCharm project folder
- A profile was created on TMDB to generate an API key to fetch posters of recommended movies
- app.py was designed to fetch posters from TMDB and generate movie names
- Movie names and posters were displayed
- App was deployed to Streamlit Community Cloud
-
Clone the repository:
git clone https://github.com/rohanrvpatil/movie-recommendation-system.git
-
Install the required packages:
pip install -r requirements.txt
-
Get a TMDB API key from here and store it in
.streamlit/secrets.toml
:# .streamlit/secrets.toml [general] tmdb_api_key = "your_tmdb_api_key"
-
Access the API key in your
app.py
:import streamlit as st tmdb_api_key = st.secrets["general"]["tmdb_api_key"] # Use the API key to fetch data from TMDB
-
Run the Streamlit app:
streamlit run app.py
Tip
Use VPN if the movie recommender system is not working. API requests to TMDB from certain countries don't work