This project is an SMS Spam Classifier built using a Naive Bayes classifier. The application is developed with Streamlit, allowing users to easily interact with the model and classify SMS messages as spam or not spam.
- User-friendly interface to input SMS messages.
- Real-time classification of messages as spam or ham (not spam).
- Visualizations of model performance metrics.
- Built with a Naive Bayes classifier for efficient spam detection.
- Python
- Streamlit
- Scikit-learn
- Pandas
- NLTK (Natural Language Toolkit)
- NumPy
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/chauhan-pratham/SMS_Spam_Classifier
-
Open Your Command Line Interface (CLI):
- On Windows, you can use Command Prompt or PowerShell.
- On macOS or Linux, you can use the Terminal.
-
Change Directory to the Repository: After cloning, you need to navigate into the repository's directory. Use the
cd(change directory) command:cd SMS_Spam_Classifier
-
List Files: Once you are in the repository, you can list the files and directories using:
ls # On macOS/Linux dir # On Windows
-
Check Current Directory: If you want to confirm that you are in the correct directory, you can use:
pwd # On macOS/Linux cd # On Windows
-
Return to Previous Directory: If you need to go back to the previous directory, you can use:
cd ..
-
Install the required packages:
pip install -r requirements.txt
-
Run the Streamlit application:
streamlit run app.py
Note: When you type this web-browser will open and will load you app.
- Enter an SMS message in the input box and click the "Predict" button to see if the message is spam or not.
- Data Collection: The model is trained on a dataset of SMS messages labeled as spam or ham.
- Preprocessing: The text data is cleaned and preprocessed using techniques such as tokenization, stopword removal, and vectorization.
- Model Training: A Naive Bayes classifier is trained on the preprocessed data.
- Prediction: The trained model predicts whether a new SMS message is spam or not based on user input.