# mudassira10/spam-sms-detector architecture

> Architecture diagram of the GitHub repository mudassira10/spam-sms-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mudassira10/spam-sms-detector
- Repository: https://github.com/mudassira10/spam-sms-detector

## Overview

SpamGuard AI is a Streamlit SMS spam detector. A user submits a message, which is vectorized for Linear SVM classification and independently checked for suspicious patterns; the prediction and warnings inform a risk score and displayed result. The implementation is concentrated in app.py, with the trained model and TF-IDF vectorizer stored as pickle artifacts. The README documents the overall workflow; the excerpts show the safety checks, scoring, model loading, and result rendering, but omit some intervening code.

Main entry points: [`app.py`](https://github.com/mudassira10/spam-sms-detector/blob/main/app.py) (Message Input), [`tfidf.pkl`](https://github.com/mudassira10/spam-sms-detector/blob/main/tfidf.pkl) (TF-IDF Vectorizer), [`spam_model.pkl`](https://github.com/mudassira10/spam-sms-detector/blob/main/spam_model.pkl) (Spam Classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Message Interface"]
  node_input["Message Input<br/>[app.py]"]
end

subgraph group_analysis["Detection"]
  node_vectorizer["TF-IDF Vectorizer<br/>[tfidf.pkl]"]
  node_classifier["Spam Classifier<br/>[spam_model.pkl]"]
  node_safety["Safety Checks<br/>[app.py]"]
end

subgraph group_results["Risk Results"]
  node_risk["Risk Assessment<br/>[app.py]"]
  node_display["Detection Results<br/>[app.py]"]
end

node_user(("SMS User"))

node_user -->|"submits message"| node_input
node_input -->|"vectorizes text"| node_vectorizer
node_vectorizer -->|"provides features"| node_classifier
node_input -->|"checks message"| node_safety
node_classifier -->|"provides prediction"| node_risk
node_safety -->|"provides warnings"| node_risk
node_risk -->|"renders assessment"| node_display
node_display -->|"shows result"| node_user

click node_input "https://github.com/mudassira10/spam-sms-detector/blob/main/app.py"
click node_vectorizer "https://github.com/mudassira10/spam-sms-detector/blob/main/tfidf.pkl"
click node_classifier "https://github.com/mudassira10/spam-sms-detector/blob/main/spam_model.pkl"
click node_safety "https://github.com/mudassira10/spam-sms-detector/blob/main/app.py"
click node_risk "https://github.com/mudassira10/spam-sms-detector/blob/main/app.py"
click node_display "https://github.com/mudassira10/spam-sms-detector/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_input,node_user toneBlue
class node_vectorizer,node_classifier,node_safety toneAmber
class node_risk,node_display toneMint
```

## Components

### Message Interface

- [Message Input](https://github.com/mudassira10/spam-sms-detector/blob/main/app.py): `app.py`

### Detection

- [TF-IDF Vectorizer](https://github.com/mudassira10/spam-sms-detector/blob/main/tfidf.pkl): `tfidf.pkl`
- [Spam Classifier](https://github.com/mudassira10/spam-sms-detector/blob/main/spam_model.pkl): `spam_model.pkl`
- [Safety Checks](https://github.com/mudassira10/spam-sms-detector/blob/main/app.py): `app.py`

### Risk Results

- [Risk Assessment](https://github.com/mudassira10/spam-sms-detector/blob/main/app.py): `app.py`
- [Detection Results](https://github.com/mudassira10/spam-sms-detector/blob/main/app.py): `app.py`

### Other components

- **SMS User**

## Connections

- SMS User → Message Input: submits message (evidence: `README.md`)
- Message Input → TF-IDF Vectorizer: vectorizes text (evidence: `README.md`)
- TF-IDF Vectorizer → Spam Classifier: provides features (evidence: `README.md`)
- Message Input → Safety Checks: checks message (evidence: `app.py`)
- Spam Classifier → Risk Assessment: provides prediction (evidence: `app.py`)
- Safety Checks → Risk Assessment: provides warnings (evidence: `app.py`)
- Risk Assessment → Detection Results: renders assessment (evidence: `app.py`)
- Detection Results → SMS User: shows result (evidence: `README.md`)
