Skip to content

GreyHatStyle/Spam-SMS-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPAM HAM SMS Detection

The website simulates a two-way SMS conversation between two users Alice and Bob, to demonstrate real-time SPAM messages detection using Deep learning. Its Responsive and can work in minimum 320px screen width.

image

Table of Contents

  1. How It Works
  2. Public API Access
  3. Project Structure
  4. Setup Locally
  5. Feedback
  6. Author

How It Works

  • Two mobile devices are rendered in the frontend, built using React + TypeScript, implemented in frontend/.
    • One for Alice.
    • One for Bob.
  • Then, using both devices, messages can be shared between each other, just like regular SMS chat.
  • In the backend, every outgoing message is first passed through a spam detection API, built using FastAPI, implemented in the backend/ repo.
  • The REST API uses a deep learning Bi-directional LSTM model (trained in the ml/ repo), to classify messages as:
    • 🟢 Ham: Delivered to main inbox, with a notification sound.
    • 🔴 Spam: Redirected to a separate Spam box of device, with no notification sound.
  • This effectively simulates real-time Spam SMS filtering between mobile devices.

Public API Access

You can directly use my hosted Spam Detection API to classify your own sms or messages also, without running the project locally.

Usage Limit: To conserve limited server resources, only 50 requests per day are allowed per user, hence please use the API responsibly.

Endpoint

POST https://manasbisht.tech/ml/spam

Request Body (JSON):

{
  "text": "Any SMS or text, which needs to be checked whether spam or ham"
}

Sample Response:

{
  "status": "success",
  "message": "Ham"
}

Example

1. Javascript:

fetch('https://manasbisht.tech/ml/spam',{
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      text: 'You’ve been selected for a free vacation!',
    }),
  })
  .then(response => response.json())
  .then(data => {
    console.log('Prediction:', data.message); // "Spam" or "Ham"
  })
  .catch(error => {
    console.error('Error:', error);
  }
);

2. Axios in React

import axios from 'axios';

const checkSpam = async (text) => {
  try{
    const response = await axios.post('https://manasbisht.tech/ml/spam', {
      text: text,
    });

    console.log('Prediction:', response.data.message); // "Spam" or "Ham"
  }
  catch(error){
    console.error('API Error:', error);
  }
};

// Example usage
checkSpam("You’ve won a free prize! Click here to claim.");

3. Curl

curl -X POST https://manasbisht.tech/ml/spam \
  -H "Content-Type: application/json" \
  -d '{"text": "Congratulations Customer!! you have been debited 2 lakh rupees!!"}'

Project Structure

Setup Locally

  1. Clone the Project
git clone https://github.com/GreyHatStyle/Spam-SMS-detection.git
  1. Setup Frontend

  2. Setup Backend

Feedback

If you have any feedback, please reach out to me at manasbisht1142004@gmail.com.

Author

About

The website simulates a two-way SMS conversation between two users Alice and Bob, to demonstrate real-time SPAM messages detection using Deep learning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors