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.
- Technology Stack - React JS + Typescript and FastAPI.
- Headless Website -
- Frontend is deployed in Vercel.
- Backend is deployed separately in AWS EC2 instance.
- Link - https://spam-sms-detection-virid.vercel.app/
- 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.
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.
POST https://manasbisht.tech/ml/spamRequest Body (JSON):
{
"text": "Any SMS or text, which needs to be checked whether spam or ham"
}Sample Response:
{
"status": "success",
"message": "Ham"
}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!!"}'frontend/: *React + TypeScript website simulating two mobile devices for SMS communication between them, click here to know more....backend/: FastAPI application, for exposing the prediction model Rest API endpoint, click here to know more....ml/: Jupyter notebooks containing data preprocessing and Bi-directional LSTM model training and testing process, click here to know more....
- Clone the Project
git clone https://github.com/GreyHatStyle/Spam-SMS-detection.git-
Setup Frontend
- Visit here to do so, frontend setup.
-
Setup Backend
- Visit here to do so, backend setup.
If you have any feedback, please reach out to me at manasbisht1142004@gmail.com.