📧 SVM Email Spam Classifier
A machine learning project that classifies emails as Spam or Ham (Not Spam) using TF-IDF Vectorization and Support Vector Machine (SVM). The project includes a Streamlit web app, and the trained model is saved using joblib.
🚀 Features
Converts email text into numerical features using TF-IDF
Uses SVM with RBF kernel for classification
Clean and fast email prediction
Simple Streamlit UI for user input
Model & vectorizer saved and loaded using joblib
📂 Project Structure spam-classifier/ │── svm_model.joblib #Saved SVM model │── vectorizer.joblib #Saved TF-ID vectorizer │── app.py #app for prediction │── README.md # Project documentation |__requirements.txt
🌐 Running the App
Run the Streamlit web app:
streamlit run app.py
A webpage will open where you can paste any email text, and the model will classify it as:
✔ HAM — The email is safe 🚨 SPAM — Suspicious email detected
🛠 Installation
Install the required packages:
pip install streamlit scikit-learn joblib pandas
🧠 How It Works
User enters an email
The saved TF-IDF vectorizer converts text → numerical features
The saved SVM model predicts spam or ham
Streamlit displays the result instantly
📦 Deployment
You can deploy this project to:
Streamlit Cloud
HuggingFace Spaces
Render
Any cloud platform supporting Python
⭐ Future Improvements
Add probability/probability heatmap
Add email preprocessing (cleaning)
Try Naive Bayes / Logistic Regression models
Visualize word importance