π§ 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