# lovishaggarwal45/movie_recommendation architecture

> Architecture diagram of the GitHub repository lovishaggarwal45/movie_recommendation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lovishaggarwal45/movie_recommendation
- Repository: https://github.com/lovishaggarwal45/movie_recommendation

## Overview

This is a content-based movie recommender with a Streamlit interface and a FastAPI recommendation backend. The user searches for a title, chooses a recommendation count, and receives similar movie names. The README documents the model-preparation stages; runtime wiring is based on the sampled Python files, so the notebook’s internal implementation is not inferred.

Main entry points: [`movie_recommend.ipynb`](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/movie_recommend.ipynb) (Preprocessing and model), [`app.py`](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py) (Title validation and lookup), [`streamlit_app.py`](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/streamlit_app.py) (Search and results UI), [`df.pickle`](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/df.pickle) (Processed movie data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Model preparation"]
  node_dataset["Movie dataset<br/>[Data.csv]"]
  node_notebook["Preprocessing and model"]
end

subgraph group_artifacts["Model artifacts"]
  node_vectorizer["Text vectorizer<br/>[vectorizer.pkl]"]
  node_features["Feature vectors<br/>[X.pkl]"]
  node_movieframe["Processed movie data<br/>[df.pickle]"]
  node_indices["Movie index mapping<br/>[indices.pkl]"]
end

subgraph group_backend["Recommendation backend"]
  node_api["Recommendation API<br/>[app.py]"]
  node_lookup["Title validation and lookup<br/>[app.py]"]
  node_similarity["Cosine similarity ranking<br/>[app.py]"]
  node_useresults["Recommendations<br/>[app.py]"]
end

subgraph group_frontend["Web interface"]
  node_ui["Search and results UI<br/>[streamlit_app.py]"]
end

node_user(("Movie seeker"))

node_dataset -->|"loads and preprocesses"| node_notebook
node_notebook -->|"produces"| node_vectorizer
node_notebook -->|"produces"| node_features
node_notebook -->|"produces"| node_movieframe
node_notebook -->|"produces"| node_indices
node_user -->|"searches"| node_ui
node_ui -->|"loads titles"| node_movieframe
node_ui -->|"requests recommendations"| node_api
node_api -->|"dispatches"| node_lookup
node_lookup -->|"checks title"| node_movieframe
node_lookup -->|"finds index"| node_indices
node_lookup -->|"calls ranking"| node_similarity
node_similarity -->|"scores vectors"| node_features
node_similarity -->|"ranks titles"| node_useresults
node_lookup -->|"returns not-found response"| node_useresults
node_api -->|"returns recommendations"| node_useresults
node_useresults -->|"HTTP response"| node_ui
node_ui -->|"displays results"| node_user

click node_dataset "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/Data.csv"
click node_notebook "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/movie_recommend.ipynb"
click node_vectorizer "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/vectorizer.pkl"
click node_features "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/X.pkl"
click node_movieframe "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/df.pickle"
click node_indices "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/indices.pkl"
click node_ui "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/streamlit_app.py"
click node_api "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py"
click node_lookup "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py"
click node_similarity "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py"
click node_useresults "https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_notebook toneBlue
class node_vectorizer,node_features,node_movieframe,node_indices toneAmber
class node_api,node_lookup,node_similarity,node_useresults toneMint
class node_ui toneRose
class node_user toneIndigo
```

## Components

### Model preparation

- [Movie dataset](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/Data.csv): `Data.csv`
- [Preprocessing and model](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/movie_recommend.ipynb): `movie_recommend.ipynb`

### Model artifacts

- [Text vectorizer](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/vectorizer.pkl): `vectorizer.pkl`
- [Feature vectors](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/X.pkl): `X.pkl`
- [Processed movie data](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/df.pickle): `df.pickle`
- [Movie index mapping](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/indices.pkl): `indices.pkl`

### Recommendation backend

- [Recommendation API](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py): `app.py`
- [Title validation and lookup](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py): `app.py`
- [Cosine similarity ranking](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py): `app.py`
- [Recommendations](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/app.py): `app.py`

### Web interface

- [Search and results UI](https://github.com/lovishaggarwal45/movie_recommendation/blob/main/streamlit_app.py): `streamlit_app.py`

### Other components

- **Movie seeker**

## Connections

- Movie dataset → Preprocessing and model: loads and preprocesses
- Preprocessing and model → Text vectorizer: produces
- Preprocessing and model → Feature vectors: produces
- Preprocessing and model → Processed movie data: produces
- Preprocessing and model → Movie index mapping: produces
- Movie seeker → Search and results UI: searches
- Search and results UI → Processed movie data: loads titles
- Search and results UI → Recommendation API: requests recommendations
- Recommendation API → Title validation and lookup: dispatches
- Title validation and lookup → Processed movie data: checks title
- Title validation and lookup → Movie index mapping: finds index
- Title validation and lookup → Cosine similarity ranking: calls ranking
- Cosine similarity ranking → Feature vectors: scores vectors
- Cosine similarity ranking → Recommendations: ranks titles
- Title validation and lookup → Recommendations: returns not-found response
- Recommendation API → Recommendations: returns recommendations
- Recommendations → Search and results UI: HTTP response
- Search and results UI → Movie seeker: displays results
