# sri-raj-2222/spam_detection__system architecture

> Architecture diagram of the GitHub repository sri-raj-2222/spam_detection__system, 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/sri-raj-2222/spam_detection__system
- Repository: https://github.com/sri-raj-2222/spam_detection__system

## Overview

This is a Streamlit SMS spam detector. A user enters a message and requests a check; the app cleans, removes stop words, and stems the text, transforms it with the saved TF-IDF vectorizer, then predicts and displays Spam or Not Spam. The graph reflects the sampled runtime in app.py; the CSV and notebook are present, but their role in training or runtime is not established by the available evidence.

Main entry points: [`app.py`](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py) (Streamlit App), [`vectorizer.pkl`](https://github.com/sri-raj-2222/spam_detection__system/blob/main/vectorizer.pkl) (Saved Vectorizer), [`model.pkl`](https://github.com/sri-raj-2222/spam_detection__system/blob/main/model.pkl) (Spam Classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_streamlit_app["Streamlit App<br/>[app.py]"]
  node_message_input["Message Input<br/>[app.py]"]
  node_result_display["Result Display<br/>[app.py]"]
end

subgraph group_preprocessing["Text Preprocessing"]
  node_text_cleaning["Text Cleaning<br/>[app.py]"]
  node_stopword_removal["Stopword Removal<br/>[app.py]"]
  node_stemming["Word Stemming<br/>[app.py]"]
  node_english_stopwords[("English Stopwords")]
end

subgraph group_inference["Classification"]
  node_tfidf_transform["TF-IDF Transform<br/>[app.py]"]
  node_vectorizer["Saved Vectorizer<br/>[vectorizer.pkl]"]
  node_spam_model["Spam Classifier<br/>[model.pkl]"]
end

node_user(("User"))

node_user -->|"enters message"| node_message_input
node_message_input -->|"provides message"| node_streamlit_app
node_streamlit_app -->|"cleans text"| node_text_cleaning
node_streamlit_app -->|"removes words"| node_stopword_removal
node_stopword_removal -->|"reads list"| node_english_stopwords
node_streamlit_app -->|"stems text"| node_stemming
node_streamlit_app -->|"transforms text"| node_tfidf_transform
node_streamlit_app -->|"loads vectorizer"| node_vectorizer
node_tfidf_transform -->|"vectorizes text"| node_vectorizer
node_streamlit_app -->|"loads model"| node_spam_model
node_streamlit_app -->|"predicts class"| node_spam_model
node_streamlit_app -->|"shows prediction"| node_result_display
node_result_display -->|"displays result"| node_user

click node_streamlit_app "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_message_input "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_result_display "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_text_cleaning "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_stopword_removal "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_stemming "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_tfidf_transform "https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py"
click node_vectorizer "https://github.com/sri-raj-2222/spam_detection__system/blob/main/vectorizer.pkl"
click node_spam_model "https://github.com/sri-raj-2222/spam_detection__system/blob/main/model.pkl"

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_streamlit_app,node_message_input,node_result_display,node_user toneBlue
class node_text_cleaning,node_stopword_removal,node_stemming,node_english_stopwords toneAmber
class node_tfidf_transform,node_vectorizer,node_spam_model toneMint
```

## Components

### User Interface

- [Streamlit App](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`
- [Message Input](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`
- [Result Display](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`

### Text Preprocessing

- [Text Cleaning](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`
- [Stopword Removal](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`
- [Word Stemming](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`
- **English Stopwords**

### Classification

- [TF-IDF Transform](https://github.com/sri-raj-2222/spam_detection__system/blob/main/app.py): `app.py`
- [Saved Vectorizer](https://github.com/sri-raj-2222/spam_detection__system/blob/main/vectorizer.pkl): `vectorizer.pkl`
- [Spam Classifier](https://github.com/sri-raj-2222/spam_detection__system/blob/main/model.pkl): `model.pkl`

### Other components

- **User**

## Connections

- User → Message Input: enters message
- Message Input → Streamlit App: provides message
- Streamlit App → Text Cleaning: cleans text
- Streamlit App → Stopword Removal: removes words
- Stopword Removal → English Stopwords: reads list
- Streamlit App → Word Stemming: stems text
- Streamlit App → TF-IDF Transform: transforms text
- Streamlit App → Saved Vectorizer: loads vectorizer
- TF-IDF Transform → Saved Vectorizer: vectorizes text
- Streamlit App → Spam Classifier: loads model
- Streamlit App → Spam Classifier: predicts class
- Streamlit App → Result Display: shows prediction
- Result Display → User: displays result
