Get Appointment

Email Classifier

Intelligent Email Classification with Machine Lear

W An intelligent email classification system using Machine Learning and Natural Language Processing (NLP). This API can classify emails into categories like spam, personal, work, promotions

Category
Web App
Source Code
View
Published
Aug. 14, 2025

Project Summery

An intelligent email classification system using Machine Learning and Natural Language Processing (NLP). This API can classify emails into categories like spampersonalworkpromotions, etc.


🚀 Features

  • 🔍 Pre-trained ML model using Logistic Regression
  • 🧠 Text preprocessing with TF-IDF
  • ⚡ FastAPI backend with prediction endpoint
  • 🧪 Swagger docs for testing API
  • 🗂️ Easily extendable with more categories or models

🏗️ Project Structure

  • email_classifier/
    • app/
      • main.py # FastAPI app for handling API routes
      • model.py # (Optional) Logic to load and predict using ML model
    • model/
      • email_classifier.pkl # Trained ML model file (TF-IDF + Logistic Regression)
    • train/
      • train_model.py # Script to train and save the model
      • dataset.csv # Email data with text and labels
    • requirements.txt # Python dependencies
    • README.md # Project documentation

🧠 Model

  • Algorithm: Logistic Regression
  • Vectorizer: TF-IDF
  • Labelsspampersonalworkpromotionsupdates, etc.

⚙️ Installation

  1. Clone the repository:

    git clone https://github.com/sujit-codezen/ai_email_classifier.git
    cd email_classifier
  2. Create virtual environment (optional but recommended):

    python -m venv env
    source env/bin/activate  # On Windows: env\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Train the Model:

    cd train
    python train_model.py
  5. Run the API Server:

    cd ../app
    uvicorn main:app --reload

Output

 

alt text

Share