Skip to content

Avik-Das-567/Netflix-Style-Movie-Recommender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ Netflix-Style Movie Recommender

A content-based movie recommender system built with Flask, combining machine learning and interactive visualizations.
Inspired by Netflix, this web app offers personalized recommendations, trending titles, and direct trailer links β€” all in a simple, clean interface.


✨ Features at a Glance

  • πŸ” User Authentication: Sign up, log in, manage sessions securely.
  • 🎯 Personalized Recommendations: Suggests similar movies using NLP-based content filtering.
  • πŸ“ˆ Trending Section: Highlights top-rated movies (rating > 9).
  • πŸ“Š Visualizations: Language distribution & genre-wise average rating charts.
  • 🎬 Watch Trailers: One-click trailer links from YouTube.
  • πŸ›’ Subscription Plans: Simulated subscription page with confirmation screen.

🧠 How It Works

This project uses a content-based filtering approach to recommend movies. Here’s an overview of the data flow and logic:

1️⃣ Data Collection & Cleaning

  • Raw movie data is stored in dataset/movies_dataset.csv.

  • clean_data.py:

    • Removes duplicates and incomplete records.
    • Standardizes text fields (lowercase, trims spaces).
    • Ensures all movies have valid ratings and image references.
  • Clean data is saved to dataset/cleaned_movies.csv.

2️⃣ Feature Engineering & Model Training

  • train.py:

    • Merges key metadata fields: tags, genre, actor, and language into a single text field.
    • Uses CountVectorizer (from scikit-learn) to create vector embeddings of each movie.
    • Computes cosine similarity between all movie vectors.
  • Saves:

    • pkl/movies.pkl: DataFrame of cleaned movies with metadata.
    • pkl/similarity.pkl: Pre-computed similarity matrix.

3️⃣ Web Application (Flask)

  • app.py:

    • Handles routing, user sessions, and rendering templates.
    • Supports login, signup, logout, recommendations, admin view, and data visualizations.
  • Recommendations are served instantly using the pre-computed similarity matrix.

4️⃣ Database

  • User accounts stored in SQLite (database/users.db).

  • Created using netflixdb.py script with fields:

    • id (primary key)
    • email (unique)
    • password (plain text)

πŸ› Project Structure

Netflix-App/
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ clean_data.py
β”‚   β”œβ”€β”€ netflixdb.py
β”‚   └── train.py
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ login.css
β”‚   β”‚   β”œβ”€β”€ signup.css
β”‚   β”‚   β”œβ”€β”€ style.css
β”‚   β”‚   β”œβ”€β”€ subscription.css
β”‚   β”‚   └── watch.css
β”‚   β”‚
β”‚   └── img/
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ admin.html
β”‚   β”œβ”€β”€ home.html
β”‚   β”œβ”€β”€ login.html
β”‚   β”œβ”€β”€ payment_success.html
β”‚   β”œβ”€β”€ signup.html
β”‚   β”œβ”€β”€ subscription.html
β”‚   β”œβ”€β”€ visualize.html
β”‚   └── watch.html
β”‚
β”œβ”€β”€ dataset/
β”‚   β”œβ”€β”€ movies_dataset.csv
β”‚   β”œβ”€β”€ movie_links.csv
β”‚   └── cleaned_movies.csv
β”‚
β”œβ”€β”€ pkl/
β”‚   β”œβ”€β”€ movies.pkl
β”‚   └── similarity.pkl
β”‚
β”œβ”€β”€ database/
β”‚   └── users.db
β”‚
└── app.py

βš™οΈ Main Modules & Scripts

Script Purpose
clean_data.py Cleans raw data, standardizes text, removes duplicates, handles missing values
train.py Generates vectors & similarity matrix using CountVectorizer & Cosine Similarity
netflixdb.py Creates SQLite database for user login
app.py Flask app: handles routing, sessions, recommendations, visualizations

πŸ“Š Key Functionalities & Visualizations

  • Visualizations (/visualize route)

    • Pie Chart : Shows distribution of movies by language
    • Bar Chart : Displays genres where the average rating exceeds 8
    • Dynamically generated using matplotlib and embedded directly in the web interface
  • Watch trailers (/watch/<movie> route)

    • Opens the trailer/watch link using pre-collected YouTube URLs stored in movie_links.csv
  • Subscription & Payment

    • /subscriptions : Displays sample subscription plans.
    • /payment_success : Confirms selected plan after form submission.
  • Admin View (/admin)

    • Opens the login page. If logged in as admin, redirects to the homepage like a regular user.

🎬 Recommendation Logic

When a user selects a movie:

  • The app retrieves its index from the movies DataFrame.
  • Then extracts its similarity scores from the matrix.
  • Sorts other movies by descending similarity score.
  • Recommends the top 5 most similar movies.

Recommendations include:

  • Title
  • Genre
  • Language
  • Rating
  • Poster image (via image_file column)

πŸ§ͺ Technologies & Libraries Used

  • Python & Flask: Web framework & backend
  • SQLite: Lightweight relational database
  • Pandas: Data cleaning & processing
  • scikit-learn: NLP vectorization & similarity calculation
  • Matplotlib: Data visualization
  • HTML: Templates
  • pickle: Used to save and load preprocessed data (movie metadata & similarity matrix)

πŸš€ How to Run Locally

  • Navigate to your local Netflix-App folder, and open Command Prompt in that folder. Create a virtual environment :

    python -m venv venv  
    
  • Activate the virtual environment :

    venv\Scripts\activate
    
  • Install required dependencies : flask, pandas, scikit-learn, matplotlib.

    pip install flask pandas scikit-learn matplotlib
    
  • Prepare the database :

    python scripts/netflixdb.py
    

    This creates users.db to store usernames and passwords.

  • Clean the data :

    python scripts/clean_data.py
    

    This generates the cleaned_movies.csv dataset.

  • Train the Recommendation Model :

    python scripts/train.py
    

    This generates movies.pkl & similarity.pkl.

  • Run the app :

    python app.py
    
  • Open your browser and go to :

    http://127.0.0.1:5000
    

πŸ“Έ Preview Images (Screenshots of the App)

  • Homepage :

Homepage_1

  • Recommendations Page :

Homepage_2

  • Visualizations Page :

Visualization_Page

  • Sign-up Page :

Signup_Page

  • Sign-in Page :

Login_Page

  • "Watch Now" Page :

Watch_on_youtube

  • Subscriptions Page :

Subscriptions_Page

  • "Payment Success" Page :

Payment_Page


πŸš€ Possible Future Improvements

  • Replace plain-text password storage with secure hashing

  • Allow users to rate movies and track favorites or watchlists

  • Add search auto-suggestions with fuzzy matching for better UX

  • Integrate interactive visualizations using Plotly or Chart.js

  • Enable basic subscription logic (e.g., restrict features based on plan)

  • Improve UI with animations and responsive layouts

  • Add movie filtering by genre, language, or rating


πŸ‘€ Author

Built by Avik β€” For learning, experimenting, and exploring Machine Learning with real-world web apps.


πŸ“„ License

This is an open-source portfolio project. Feel free to use, modify, or extend it!


About

A Netflix-style movie recommender built with Python & Flask, using NLP vectorization & cosine similarity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published