Spam Mail Classifier
by Garvit Pujari • FastAPI on Hugging Face
Open API

Is this email Spam or Ham?

This page explains how spam works, what signs to look for, and lets you test a machine-learning model that classifies emails using TF-IDF + Logistic Regression.

What is Spam?

Unsolicited or deceptive emails

Often includes scams, phishing, fake prizes, or aggressive marketing. Goal: get you to click, pay, or share personal info.

Common Signs
  • Urgent language or threats (“act now”, “final notice”).
  • Unknown sender or mismatched domains.
  • Spelling/grammar errors; suspicious links/attachments.
  • Requests for passwords, OTPs, or payments.
Model Overview

TF-IDF + Logistic Regression

Email text is converted to numeric features via TF-IDF; a trained classifier predicts Spam (0) or Ham (1).

Try the Classifier

Live Demo
Stay Safe
  • Don’t click unknown links or download unexpected attachments.
  • Verify sender addresses; beware look-alike domains.
  • Never share passwords/OTP; banks won’t ask by email.
  • Enable spam filters and 2-factor authentication.
Limitations

ML models aren’t perfect. Borderline or novel spam may slip through. Combine automated detection with human judgment.

API Quickstart

Use /predict endpoint with JSON body {"message": "your text"} to classify via API.