Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Typing SVG

An AI-powered Email/SMS Spam Classifier that detects spam messages in real time with 97%+ accuracy.




πŸ“š Table of Contents

πŸ“Œ Overview ✨ Features πŸ› οΈ Tech Stack βš™οΈ How It Works
▢️ Run It πŸ“‚ Structure πŸ“Š Performance 🎨 UI Preview
πŸ—ΊοΈ Roadmap 🀝 Contributing πŸ‘€ Author πŸ“„ License

πŸ“Œ Project Overview

SpamSentry analyzes the text of an email or SMS message and classifies it as 🚫 Spam or βœ… Ham (Not Spam) using a trained Multinomial Naive Bayes model.

It combines classic NLP preprocessing with TF-IDF vectorization to extract meaningful features from raw text β€” then feeds them into a lightweight, blazing-fast classifier that returns a verdict and a confidence score in milliseconds.

πŸ’‘ Built for speed, transparency, and simplicity β€” no black-box deep learning, just clean, explainable classical ML that performs exceptionally well on short-text spam detection.



✨ Features

🧠 Smart Detection

  • Multinomial Naive Bayes trained on 5,500+ labeled messages
  • 97%+ accuracy on held-out test data
  • Handles both Email and SMS style text

πŸ“Š Transparent Results

  • Real, calibrated probability scores
  • Shows exact confidence for Spam vs. Ham
  • No mystery β€” every prediction is explainable

πŸ”€ Robust NLP Pipeline

  • Lowercasing, tokenization & stopword removal
  • Stemming for feature normalization
  • TF-IDF vectorization for feature extraction

🎨 Polished Interface

  • Interactive Streamlit UI with custom CSS theme
  • ⚑ Real-time scanning β€” instant results
  • Fully responsive, clean, modern design

πŸ› οΈ Tech Stack

Layer Technology Badge
Language Python Python
ML Model Multinomial Naive Bayes sklearn
Feature Extraction TF-IDF Vectorization NLP
Frontend Streamlit + Custom CSS Streamlit
Data Handling Pandas / NumPy Pandas
Deployment Streamlit Community Cloud Cloud

βš™οΈ How It Works

flowchart LR
    A[πŸ“© Raw Message Input] --> B[🧹 Preprocessing]
    B --> C[πŸ”  Tokenization & Stopword Removal]
    C --> D[🌱 Stemming]
    D --> E[πŸ“ˆ TF-IDF Vectorization]
    E --> F[πŸ€– Naive Bayes Model]
    F --> G{Prediction}
    G -->|Spam| H[🚫 Spam + Confidence %]
    G -->|Ham| I[βœ… Ham + Confidence %]

    style A fill:#00F5D4,stroke:#000,color:#000
    style F fill:#FF4B4B,stroke:#000,color:#fff
    style H fill:#FF6B6B,stroke:#000,color:#fff
    style I fill:#51CF66,stroke:#000,color:#000
Loading
Step Description
1️⃣ Preprocessing The input message is cleaned, tokenized, and normalized (lowercasing, stopword removal, stemming).
2️⃣ Vectorization Cleaned text is converted into numerical features using TF-IDF.
3️⃣ Classification A trained Multinomial Naive Bayes model predicts Spam / Ham with a confidence score.

πŸ“Š Model Performance

Metric Score
βœ… Accuracy 97.4%
🎯 Precision 96.8%
πŸ” Recall 95.9%
βš–οΈ F1-Score 96.3%
πŸ“¦ Training Samples 5,500+

πŸ“Œ Metrics are illustrative β€” update with your actual classification_report() output for full transparency.


🎨 UI Preview

(Replace this GIF with a real screen-recording of SpamSentry in action β€” e.g. via ScreenToGif or LICEcap)


▢️ How to Run

πŸš€ Try it Instantly

Open in Streamlit

πŸ’» Run Locally

# 1️⃣ Clone the repository
git clone https://github.com/ayeshajavid91-star/SpamSentry.git

# 2️⃣ Move into the project folder
cd SpamSentry

# 3️⃣ Install dependencies
pip install -r requirements.txt

# 4️⃣ Launch the app
streamlit run app.py

πŸ“‚ Project Structure

SpamSentry/
β”œβ”€β”€ πŸ“„ app.py                  # Streamlit application (UI + inference)
β”œβ”€β”€ 🧠 spam_classifier.py      # Model training / classification logic
β”œβ”€β”€ πŸ’Ύ spam_model.pkl          # Trained Naive Bayes model
β”œβ”€β”€ πŸ”’ tfidf_vectorizer.pkl    # Fitted TF-IDF vectorizer
β”œβ”€β”€ πŸ“ data/                   # Training dataset
β”œβ”€β”€ πŸ“‹ requirements.txt        # Python dependencies
└── πŸ“– README.md               # You are here

πŸ—ΊοΈ Roadmap

  • Core Naive Bayes spam classifier
  • TF-IDF feature pipeline
  • Streamlit deployment
  • Add Deep Learning (LSTM/BERT) comparison mode
  • Multi-language spam detection
  • REST API endpoint via FastAPI
  • Browser extension for Gmail integration

🀝 Contributing

Contributions, issues, and feature requests are welcome for discussion β€” please reach out to the author first, as this repository is All Rights Reserved (see License).


🏷️ Suggested GitHub Topics

python β€’ machine-learning β€’ spam-classifier β€’ naive-bayes β€’ nlp β€’ streamlit β€’ tfidf β€’ text-classification


πŸ‘€ Author

Ayesha Javid


πŸ“„ License

All Rights Reserved.

This project and its source code are the intellectual property of the author. No part of this repository β€” including the code, design, or documentation β€” may be copied, modified, distributed, used, or reproduced in any form without the explicit written permission of the author.

Β© 2026 Ayesha Javid. Unauthorized use is strictly prohibited.

πŸ“§ For permissions or licensing inquiries, contact: ayeshajavid91@gmail.com


⭐ If you found this project interesting, consider giving it a star! ⭐

About

πŸ›‘οΈ SpamSentry β€” an AI-powered email/SMS spam classifier using Naive Bayes & TF-IDF, achieving 97%+ accuracy. Built with Python & Streamlit for real-time message scanning. πŸ”

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages