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 .
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 .
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
- Train set accuracy : 99.89%
- Validation set accuracy : 99.89%
- Train set Loss : 0.0047
- Validation set Loss : 0.0571
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.
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.
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.
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>
This project is licensed under the MIT License See the LICENSE file for details.