Skip to content

🧠 Spam Detector using Flask & TensorFlow. Classifies messages as spam or not spam with a trained LSTM+GRU model. Includes a clean Tailwind CSS frontend, JSON API, and result page. Input a message, get instant AI-powered predictions! πŸ“¨

Notifications You must be signed in to change notification settings

JoyTheSloth/Spam-SMS-detection-Model

Repository files navigation

🧠 Spam Detector - AI-Powered Message Classification

Detect spam messages with a simple and elegant web interface powered by machine learning.

πŸš€ Features

  • πŸ” Real-time spam detection using a trained LSTM + GRU neural network
  • 🧠 Built with TensorFlow and Keras
  • 🌐 Interactive frontend with Tailwind CSS
  • πŸ—‚ Flask API for backend prediction
  • πŸ” Live result display with modern UI

πŸ“ Project Structure

/spam-detector
β”œβ”€β”€ app.py                   # (Optional) Model training script
β”œβ”€β”€ predict_spam.py         # Flask API for serving predictions
β”œβ”€β”€ tokenizer.pickle        # Saved tokenizer used during training
β”œβ”€β”€ spam_detection_model.h5 # Trained spam detection model
β”œβ”€β”€ SpamTrain.csv           # Training data
β”œβ”€β”€ SpamTest.csv            # Test data
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ index.html          # Frontend input page
β”‚   └── result.html         # Result display page
β”œβ”€β”€ static/                 # Optional styles/scripts

βš™οΈ How to Run

  1. Install dependencies

    pip install flask tensorflow flask-cors
  2. Start the Flask server

    python predict_spam.py
  3. Launch the frontend

    python -m http.server 8000
  4. Visit in browser

    http://localhost:8000/index.html
    

πŸ’‘ How It Works

  • User types a message into the frontend
  • The input is sent to the Flask API via a POST request
  • The server tokenizes and classifies the message as "Spam" or "Not Spam"
  • The result is shown on a separate result page

πŸ›  Tech Stack

  • Frontend: HTML, Tailwind CSS, JavaScript
  • Backend: Python, Flask, TensorFlow
  • Model: LSTM + GRU hybrid for spam classification
  • Deployment Ready: Can be served locally or hosted via Flask + frontend hosting (Netlify, Vercel, etc.)

About

🧠 Spam Detector using Flask & TensorFlow. Classifies messages as spam or not spam with a trained LSTM+GRU model. Includes a clean Tailwind CSS frontend, JSON API, and result page. Input a message, get instant AI-powered predictions! πŸ“¨

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published