finalcapstone / README.md
Eric Hierholzer
updates
069d6cd
metadata
title: Netflix Recommendation App
emoji: 🍿
colorFrom: blue
colorTo: red
sdk: docker
python_version: '3.12'
app_port: 7860
pinned: false
short_description: Netflix title recommendations using cosine similarity.
tags:
  - recommendation
  - netflix
  - flask
  - cosine-similarity
  - docker

Netflix Recommender App

A Flask-based web application that provides personalized recommendations for Netflix content using a content-based filtering approach.

Features

  • Content-based recommendations based on TF-IDF and cosine similarity
  • Search and autocomplete functionality
  • Visualizations of Netflix content distribution
  • Deployed on huggingface for easiest access
  • Works on both macOS and Windows locally
  • Docker deployment available

Prerequisites

  • Google Chrome and Internet Access

Ensure you have the following installed to build/run locally:

  • Python 3.12+ (Check with python --version or python3 --version)
  • Node.js and npm (Check with node -v and npm -v)
  • pip (Python package manager)

View application online (easiest method)

https://huggingface.co/spaces/erichier/finalcapstone

Manual Installation

1. Clone the Repository

git clone https://huggingface.co/spaces/erichier/finalcapstone
cd finalcapstone

2. Set Up a Virtual Environment

macOS & Linux

python3.12 -m venv venv
source venv/bin/activate

Windows (Command Prompt)

python -m venv venv
venv\Scripts\activate

Windows (PowerShell)

python -m venv venv
venv\Scripts\Activate.ps1

3. Install Dependencies

pip install -r requirements.txt
npm install

4. Download Dataset

Verify netflix_titles.csv is placed present from git clone. Available here if needed: https://www.kaggle.com/datasets/shivamb/netflix-shows

5. Build or Load Model & Run Application

Run the following command to preprocess the dataset and generate a similarity model:

gunicorn -w 2 -b 0.0.0.0:7860 recommend_app:app

This will load the Netflix dataset, process it, and save a cached similarity model (cosine_sim_cache.pkl).

The app will be available at:
Access app at [http://0.0.0.0:7860] or [http://localhost:7860]

File Structure

finalcapstone/
│── Dockerfile                # For huggingface or local easy deployment
│── README.md                 # Info and instructions on how to build and run
│── recommend_app.py          # Flask API entry point
│── recommendation_engine.py  # Machine Learning Recommendation Engine
│── netflix_titles.csv        # Dataset file from Kaggle.com
│── requirements.txt          # Python dependencies
│── package.json              # Frontend dependencies
│── static/
β”‚   β”œβ”€β”€ index.html            # Main frontend page
β”‚   β”œβ”€β”€ js/                   # Frontend scripts
β”‚   β”œβ”€β”€ styles.css            # Stylesheet
│── venv/                     # Python virtual environment

Stopping the Server

To stop the Flask server, press Ctrl + C in the terminal.

To deactivate the virtual environment:

macOS & Linux

deactivate

Windows

venv\Scripts\deactivate

DOCKER Deployment (optional EASY local deployment using Docker)

docker build -t my-recommend-app .
docker run -p 7860:7860 my-recommend-app

access app at http://0.0.0.0:7860 or http://localhost:7860

Example Use of the Application

Steps:

  1. Enter the name of a Netflix show or movie you like.
  2. As you type, autocomplete will suggest matching options.
  3. Select one of the autocomplete suggestions.
  4. The application will display 10 similar movies and shows, each with a corresponding similarity score percentage.