# mohamedabolyazeed/reelsentiment architecture

> Architecture diagram of the GitHub repository mohamedabolyazeed/reelsentiment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamedabolyazeed/reelsentiment
- Repository: https://github.com/mohamedabolyazeed/reelsentiment

## Overview

##### Project type and purpose
- This is a lightweight full-stack web application (“ReelSentiment”) built with Flask.
- It serves a sentiment-analysis service: users submit movie reviews through a web UI, the app vectorizes input text and runs it through a logistic regression model to return positive/negative sentiment.

##### File structure
- Top level:
- app.py – Flask web server and inference endpoints
- train_model.py – offline training pipeline that reads IMDB Dataset.csv, fits a TfidfVectorizer and logistic regression model, and serializes them as .pkl artifacts
- imdb-dataset-of-50k-movie-reviews/IMDB Dataset.csv – raw training data
- logistic_model.pkl, tfidf_vectorizer.pkl – pre-trained model and vectorizer used by app.py
- templates/ – Jinja2 HTML views (index.html for input form, result.html for output)
- Procfile, requirements.txt – deployment config for Heroku

##### Extract insights from README
- The README just names the project “ReelSentiment,” confirming it’s a sentiment-analysis web tool. No explicit architecture notes, so we infer design from code and file layout.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend Layer"
        Index["Index Page"]:::frontend
        Result["Result Page"]:::frontend
    end

    subgraph "Backend/API & Inference"
        App["Flask Server (app.py)"]:::backend
        Vectorizer["TF-IDF Vectorizer (.pkl)"]:::backend
        Model["Logistic Regression Model (.pkl)"]:::backend
    end

    subgraph "Offline Training Pipeline"
        Train["Training Pipeline (train_model.py)"]:::training
        Dataset["Raw Dataset (IMDB Dataset.csv)"]:::training
    end

    subgraph "Deployment"
        Config["Procfile"]:::deployment
        Deps["requirements.txt"]:::deployment
        Heroku["Heroku Dyno"]:::deployment
        README["README.md"]:::deployment
    end

    Index -->|"POST /predict"| App
    App -->|"load tfidf_vectorizer.pkl"| Vectorizer
    App -->|"load logistic_model.pkl"| Model
    App -->|"render result.html"| Result

    Train -->|"reads CSV"| Dataset
    Train -->|"serializes .pkl artifacts"| Vectorizer
    Train -->|"serializes .pkl artifacts"| Model

    Config -->|"deploy code"| Heroku
    Deps -->|"install dependencies"| Heroku
    App -->|"runs on"| Heroku

    click Index "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/templates/index.html"
    click Result "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/templates/result.html"
    click App "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/app.py"
    click Vectorizer "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/tfidf_vectorizer.pkl"
    click Model "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/logistic_model.pkl"
    click Train "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/train_model.py"
    click Dataset "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/imdb-dataset-of-50k-movie-reviews/IMDB Dataset.csv"
    click Config "https://github.com/mohamedabolyazeed/reelsentiment/tree/main/Procfile"
    click Deps "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/requirements.txt"
    click README "https://github.com/mohamedabolyazeed/reelsentiment/blob/main/README.md"

    classDef frontend fill:#cce5ff,stroke:#0056b3,color:#000;
    classDef backend fill:#d4edda,stroke:#155724,color:#000;
    classDef training fill:#fff3cd,stroke:#856404,color:#000;
    classDef deployment fill:#e2e3e5,stroke:#6c757d,color:#000;
```
