Skip to content

arihant1805/Spam-Message-Detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spam-Message-Detector

An End-to-End project to detect spam Text messages. It is complete end-to-end project which contains Dockerfile as well as the FastAPI app .

Requirements:

  1. Kaggle
  2. Docker
  3. GitHub

DataSet

The DataSet is taken from the kaggle, you can check it here : Spam Text Message Classification, the DataSet is also available in the repository at DataSet .

Model

Discription

The model is made by using Sequential model, with the layers like LSTM, Bidirectional and Embedding. The model look like this:

You can check the model devlopment file at the ./Model/LSTM Model.ipynb

Model Performance :

Accuracy -

  • Train set accuracy : 99.89%
  • Validation set accuracy : 99.89%

Loss -

  • Train set Loss : 0.0047
  • Validation set Loss : 0.0571

Use model :

If you want to use the model just download ./app/model.h5 and ./app/Tokenizer.pkl, and import them in your system and use accordingly, use tokenizer for data preprocessing and model for the prediction.

App

Discription

The app folder have ./app/main.py file with the App FastAPI application or object and it uses post method to take the input msg : str and do the preprocessing for you and return a json object with

{
    msg: weather the given message is spam or not.
    value: 0 - not spam, 1 - spam
}

It also have the requirements.txt with the nessasary libraries to run the app.

Use app

You can use the app by the following command:

cd app
pip install -r requirements.txt
uvicorn main:App

Then the server will start runing go toh the provided link, which you will get in terminal. and go to the /docs and try the app.

DockerFile

It contains the required script to build the docker image and it can be done using the following command:

docker build -t <file name> .

once the image is build you can run it using:

docker run <file name>

License

This project is licensed under the MIT License See the LICENSE file for details.