# lakshyaraj-singh-rao/email-spam-detector architecture

> Architecture diagram of the GitHub repository lakshyaraj-singh-rao/email-spam-detector, 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/lakshyaraj-singh-rao/email-spam-detector
- Repository: https://github.com/lakshyaraj-singh-rao/email-spam-detector

## Overview

This is a small Streamlit message-classification app with a separate notebook-based training workflow. The runtime path is user input → app → saved classifier → displayed label. The README documents dataset cleaning, model comparison and tuning, held-out evaluation, and visualizations; these are represented as notebook responsibilities. The notebook source was not sampled, so its internal execution links reflect README documentation rather than verified calls.

Main entry points: [`app.py`](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/app.py) (Streamlit app), [`spam_detection_model.pkl`](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam_detection_model.pkl) (Saved classifier), [`spam_classifier.ipynb`](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam_classifier.ipynb) (Training notebook), [`spam.csv`](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam.csv) (Labelled messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime classification"]
  node_app["Streamlit app<br/>[app.py]"]
  node_model["Saved classifier"]
  node_label["Spam label"]
end

subgraph group_training["Model training"]
  node_notebook["Training notebook"]
end

subgraph group_data["Training assets"]
  node_dataset["Labelled messages<br/>[spam.csv]"]
  node_charts["Evaluation charts"]
end

node_user(("Message sender"))

node_user -->|"enters message"| node_app
node_app -->|"loads model"| node_model
node_app -->|"requests prediction"| node_model
node_model -->|"returns prediction"| node_app
node_app -->|"displays result"| node_label
node_notebook -->|"reads data"| node_dataset
node_notebook -->|"saves pipeline"| node_model
node_notebook -->|"produces visualizations"| node_charts

click node_app "https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/app.py"
click node_model "https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam_detection_model.pkl"
click node_notebook "https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam_classifier.ipynb"
click node_dataset "https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam.csv"
click node_charts "https://github.com/lakshyaraj-singh-rao/email-spam-detector/tree/main/IMAGES"

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_app,node_model,node_label toneBlue
class node_notebook toneAmber
class node_dataset,node_charts toneMint
class node_user toneIndigo
```

## Components

### Runtime classification

- [Streamlit app](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/app.py): `app.py`
- [Saved classifier](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam_detection_model.pkl): `spam_detection_model.pkl`
- **Spam label**

### Model training

- [Training notebook](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam_classifier.ipynb): `spam_classifier.ipynb`

### Training assets

- [Labelled messages](https://github.com/lakshyaraj-singh-rao/email-spam-detector/blob/main/spam.csv): `spam.csv`
- [Evaluation charts](https://github.com/lakshyaraj-singh-rao/email-spam-detector/tree/main/IMAGES): `IMAGES`

### Other components

- **Message sender**

## Connections

- Message sender → Streamlit app: enters message
- Streamlit app → Saved classifier: loads model
- Streamlit app → Saved classifier: requests prediction
- Saved classifier → Streamlit app: returns prediction
- Streamlit app → Spam label: displays result
- Training notebook → Labelled messages: reads data
- Training notebook → Saved classifier: saves pipeline
- Training notebook → Evaluation charts: produces visualizations
