Skip to content

Amogh04/movie-recommender

Repository files navigation

🎬 Movie Recommender

A simple yet powerful movie recommender system built with Flask, leveraging NLP techniques like BoW and Cosine Similarity to suggest movies based on user preferences.

This project uses content-based filtering:

  • Uses Bag of Words and Cosine Similarity for measuring movie similarity
  • Serves recommendations through a Flask web interface
  • Fetches movie posters dynamically using the TMDb API

🛠 Installation

Prerequisites

  • Python 3.8+
  • Git

Setup Instructions

  1. Clone the repository

    git clone https://github.com/Amogh04/movie-recommender.git
    cd movie-recommender
  2. Create and activate a virtual environment

    python -m venv venv
    source venv/bin/activate  #  or `venv\Scripts\activate` on Windows
  3. Install dependencies

    pip install -r requirements.txt
  4. Add your TMDb API key Create a .env file and add:

    api_key=your_tmdb_api_key
    
  5. Place data files Ensure data.pkl and similarity.pkl are present in the root directory. They can be generated by running preprocess.py then vectorize.py. If the similarity file is too large, consider downloading it from https://drive.google.com/file/d/1RgoRbmDGVjQhMAJJ9ryObBis2gc-HY4o/view?usp=sharing or you can run fetch_pickle.py to automatically download them

💡 Usage

To run the Flask server:

flask run

Open your browser and navigate to:
http://127.0.0.1:5000/

Select a movie and view the top similar recommendations along with their posters.

🧩 Key Components

  • app.py: Flask app and routing
  • data.pkl: Preprocessed movie metadata
  • similarity.pkl: Similarity matrix (can be large)
  • recommend_movies(): Core recommendation logic using similarity scores

📊 Algorithm Details

  • Bag of Words: Movie features (overview, genres, keywords, etc.) are combined into a single string and vectorized.
  • Cosine Similarity: Used to calculate similarity between vectorized movies.
  • Top Matches: Returns the most similar movies excluding the selected one.

🌍 TMDb API Integration

Posters are fetched in real-time from The Movie Database (TMDb).
Make sure to sign up and get an API key: https://www.themoviedb.org/

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors