A simple Streamlit web app that predicts whether a message is Spam or Ham (not spam) using a machine learning model trained on text data.
- Instant Classification: Enter a message and classify it instantly as Spam or Ham.
- Machine Learning Powered: Uses a saved
TfidfVectorizerandLogistic Regressionmodel. - User-Friendly: Clean, simple interface built with Streamlit.
-
Clone the repository:
git clone https://github.com/yourusername/spam-classifier-streamlit.git cd spam-classifier-streamlit -
Install dependencies:
pip install -r requirements.txt -
Ensure you have the following files in the root directory:
app.py(the Streamlit app)vectorizer.pkl(saved TfidfVectorizer)model.pkl(saved Logistic Regression model)
Run the app locally:
streamlit run app.py
- Enter a message in the input box.
- Click Predict to see if it’s Spam or Ham.
Message: "Congratulations! You've won a free ticket." Prediction: Spam 🎉
Message: "Hey, are we meeting for coffee today?" Prediction: Ham ☕
- Python 3.7+
- Streamlit
- scikit-learn
- joblib or pickle
All dependencies are listed in requirements.txt.
- Vectorizer: TfidfVectorizer (pre-trained and saved as
vectorizer.pkl) - Classifier: Logistic Regression (pre-trained and saved as
model.pkl)
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
- Streamlit
- scikit-learn
- SMS Spam Collection Dataset
Happy classifying! 🚀