##π‘οΈ SecureMail Analyzer - Spam Email Detector
SecureMail Analyzer is a real-time email content analysis tool that detects spam emails using a Machine Learning (ML) model trained on labeled email datasets. The system analyzes message content and predicts whether an email is SPAM or HAM (legitimate).
Built with Python (Scikit-learn, Flask) for the backend and HTML, Tailwind CSS, and JavaScript for the frontend, this project demonstrates both ML implementation and web integration in a simple, educational, and visually interactive way.
#π Features
Machine Learning-Based Detection: Uses trained ML algorithms to classify email content as SPAM or HAM. High Accuracy: Achieved an accuracy of 96% on the test dataset using a Multinomial Naive Bayes model. Real-Time Prediction: Instantly analyzes pasted email content and displays classification results. Dynamic Result Visualization: Displays predictions with color-coded alerts, confidence scores, and icons. Responsive UI: Built with Tailwind CSS for smooth animations and mobile-friendly layout. Customizable Model: Supports retraining with new data for improved accuracy.
#π§ Machine Learning Model
Algorithm Used: Multinomial Naive Bayes Libraries: Scikit-learn, Pandas, NumPy, Joblib Dataset: emails.csv (contains labeled email text for spam/ham classification) Accuracy: ~96% on test data Training File: train_model.py Prediction File: predict.py
#Model Workflow
Data Preprocessing: Cleaned and tokenized email text. Feature Extraction: Used TF-IDF vectorization for text representation. Model Training: Trained a Multinomial Naive Bayes classifier. Model Saving: Saved the trained model using Joblib for deployment. Real-Time Prediction: Integrated with Flask to predict user input in real time.
#π» Tech Stack Frontend: HTML, Tailwind CSS, JavaScript Backend: Python (Flask) Machine Learning: Scikit-learn, Pandas, NumPy Icons: Lucide Icons Model Storage: Joblib
##π§© Project Structure
Spam_Email_Detector/
β
βββ app/
β βββ app.py
β βββ predict.py
β βββ train_model.py
β βββ init.py
β
βββ data/
β βββ emails.csv
β
βββ models/
β βββ email_model.joblib
β
βββ template/
β βββ index.html
β
βββ requirements.txt
βββ README.md
βββ .gitignore
#βοΈ How to Run Clone the repository: git clone https://github.com/Shikha18Shukla/Spam_email_detector.git cd Spam_email_detector
#π Example Predictions Email Example Prediction Confidence "Congratulations! Youβve won a $1000 gift card!" SPAM 98% "Reminder: Your meeting is scheduled for tomorrow at 10am." HAM 94% "Buy cheap meds online, limited-time offer!" SPAM 97%
Author: Shikha Shukla GitHub: Shikha18Shukla
##Frontend :
7_1a5fd76b](https://github.com/user-attachments/assets/2264a5e8-9d03-45cf-9b9a-9a6fd6bbcfbc)