isSpam is a full-stack project designed to classify an open email as spam or safe (ham) by analyzing its content using a trained Machine Learning model hosted as a private API service. The system is wrapped in a lightweight Chrome extension for real-time, in-browser classification.
| Component | Technology | Role | Location |
|---|---|---|---|
| ML Model | Python, Scikit-learn (Logistic Regression) | Core logic: Predicts 0 (Ham) or 1 (Spam) based on text features. | api/models/ |
| API Backend | Python, Flask, Gunicorn | Exposes the ML model as a secure, real-time HTTPS endpoint. | api/ |
| Browser Extension | JavaScript (MV3) | UI wrapper: Extracts email text, calls the API, and displays the result as a banner. | extension/ |
| Service | Status | Endpoint / Location |
|---|---|---|
| API Service | LIVE | https://isspam-ys1h.onrender.com/predict |
| Extension | LIVE | https://chromewebstore.google.com/detail/isspam/giioaghhfkefecelfjjfldaagofjmfgg?pli=1 |
| Google Workplace Marketplace add-on | Submitted for review | https://script.google.com/d/19xw2Urq0TLPHVZDgNNYuBJ-n7oZJFFIrRCxXd0HpnnnO7EYAPd3ZA2zE/edit?usp=sharing |
To use the extension, you must load it into your browser.
- Package the Extension: Create a ZIP file of the contents of the
extension/directory. (Themanifest.jsonfile must be at the root of the ZIP). - Open Chrome Extensions: Navigate to
chrome://extensions/. - Enable Developer Mode: Toggle the switch in the top right corner.
- Load Unpacked: Click the "Load unpacked" button and select the
extension/folder.
If you need to test or modify the Python backend locally, follow these steps:
- Navigate to the
api/directory. - Install dependencies: Ensure all packages are installed, including the production server Gunicorn.
pip install -r requirements.txt
- Run the API Server: The server must be running before the extension can call it on localhost.
Note: Your live extension is configured to call the Render URL, so you must change the
gunicorn app:app --bind 0.0.0.0:5000
API_ENDPOINTinextension/background.jstohttp://localhost:5000/predictto test locally.
- Open your preferred web-based email client (e.g., Gmail or Outlook).
- Open an individual email message so the full body content is visible.
- Click the "Analyze Email" extension icon in your Chrome toolbar.
- The extension extracts the text and injects a banner at the top of the email body showing the classification result:
- Spam:
⚠️ ACTION REQUIRED: Classified as SPAM. Proceed with caution. - Ham:
✨ Looks Good: Message classified as SAFE.
- Spam:
The project uses a clean separation of concerns for stability:
- Extraction: The
content.jsfile is injected upon a toolbar click (background.js) to perform DOM queries and extract the raw email body text. - Communication: The extracted text is passed to the
background.jsService Worker. - Prediction:
background.jsmakes a secure JSONPOSTrequest to the Render API (https://isspam-ys1h.onrender.com/predict). - Deployment: The Flask API is hosted by Gunicorn on Render, providing a stable, production-grade HTTPS endpoint.
- Display: The API's integer prediction (
0or1) is sent back tocontent.js, which dynamically creates or updates the result banner on the live webpage.