Skip to content

rohanrvpatil/movie-recommendation-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Movie Recommender System

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)

Screenshot 2024-03-17 221235

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.

How the cosine similarity matrix was calculated:

  1. The 2 .csv files in the dataset were merged
  2. All important columns were retained
  3. Transformations using functions were performed to convert all column values to lists
  4. The columns were merged to create a "tags" column
  5. Transformations like lowercase, stemming, removing stopwords was done on the "tags" column
  6. Cosine similarity matrix was calculated and a "recommend_movie" function was created to recommend the movies

app.py workflow:

  1. A PyCharm project was created with a virtual environment
  2. movies.pkl and similarity.pkl files were generated from the .ipynb file itself and copied to the PyCharm project folder
  3. A profile was created on TMDB to generate an API key to fetch posters of recommended movies
  4. app.py was designed to fetch posters from TMDB and generate movie names
  5. Movie names and posters were displayed
  6. App was deployed to Streamlit Community Cloud

Instructions to run project locally:

  1. Clone the repository:

    git clone https://github.com/rohanrvpatil/movie-recommendation-system.git
  2. Install the required packages:

    pip install -r requirements.txt
  3. 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"
  4. 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
  5. 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

Resources:

  1. TMDB 5000 Movie Dataset
  2. API key creation
  3. YouTube link of project

About

A movie recommendation system to recommend TMDB movies on the basis of cosine similarity

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published