A machine learning-based web application that detects whether a given SMS message is spam or not. The application uses a Support Vector Machine (SVM) classifier with TfidfVectorization to make predictions.
- Real-time SMS spam detection
- Web-based interface for easy interaction
- Probability scores for predictions
- Built with Flask and scikit-learn
Before running this project, make sure you have the following installed:
- Python 3.7 or higher
- pip (Python package installer)
- Clone this repository:
git clone https://github.com/Abhay-Mmmm/SMS-Spam-Detector.git
cd SMS-Spam-Detector- Create a virtual environment (recommended):
# On Windows
python -m venv venv
venv\Scripts\activate
# On macOS/Linux
python3 -m venv venv
source venv/bin/activate- Install the required packages:
pip install flask pandas scikit-learnSMS-Spam-Detector/
├── app.py # Main Flask application
├── templates/ # HTML templates
├── spam.csv # Training dataset
├── test_score.csv # Test dataset
└── Detector_Model.ipynb # Jupyter notebook for model development
-
Make sure you're in the project directory and your virtual environment is activated.
-
Run the Flask application:
python app.py- Open your web browser and navigate to:
http://localhost:5000 (Default)
- Enter an SMS message in the text input field
- Click the "Classify" button
- The application will display whether the message is spam or not, along with probability scores
- The model uses a Support Vector Machine (SVM) classifier with a linear kernel
- Text is vectorized using TF-IDF (Term Frequency-Inverse Document Frequency)
- The model is trained on a dataset of 4,400 SMS messages
- The remaining messages are used for testing
Feel free to submit issues and enhancement requests!
This project is licensed under the MIT License.
