This project aims to detect spam messages. It provides a web-based interface where users can input a message, and the system predicts whether it's spam or not using a machine learning model.
The dataset used for training and testing the spam detection model is stored in spam.csv
.
To use the application:
- Clone the repository.
- Install the required dependencies using
pip install -r requirements.txt
. - Run the application using
streamlit run app.py
. - Enter the message in the provided text area and click on the "Predict" button to get the prediction.
The main code for the project is provided in app.py
. It utilizes the streamlit
library for creating the web interface, and the pickle
, nltk
, and scikit-learn
libraries for model loading, text preprocessing, and prediction.
The transform_text
function in app.py
is responsible for preprocessing the input text. It converts the text to lowercase, tokenizes it, removes stopwords and punctuation, and performs stemming.
The machine learning model used for spam detection is loaded from model.pkl
. It is trained using the TF-IDF vectorization technique.
The required Python libraries are listed in requirements.txt
, including nltk
, streamlit
, scikit-learn
, and streamlit_lottie
.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions to this project are welcome.