Skip to content

Repository files navigation

Inbox Intelligence — Email Classification + Reply Assistant

A compact, practical system that automatically classifies incoming emails and suggests short professional replies. Built for experimentation and lightweight deployment: FastAPI backend with an ML model, and a minimal React frontend with a polished dark UI.


Features

  • Fast hybrid classification (keyword heuristics + LinearSVC ML fallback)
  • Three labels: high_priority, normal, spam
  • Reply suggestion endpoint to generate one-sentence professional replies
  • Minimal, responsive React UI with dark mode and smooth animations
  • Docker + docker-compose for full-stack local deployment
  • Nginx reverse proxy configuration for production-ready static serving and API proxying

Architecture

                ┌──────────────────────┐
                │      Browser UI      │
                │  (React, Axios)      │
                └──────────┬───────────┘
                           │
                  (requests to /predict, /suggest_reply)
                           │
             ┌─────────────▼─────────────┐
             │         Nginx proxy       │
             │  (serves frontend build,  │
             │   proxies /api -> backend)│
             └───────┬─────────┬─────────┘
                     │         │
           (80/static)     (8000/api)
                     │         │
        ┌────────────▼─┐   ┌───▼────────┐
        │ Frontend     │   │ Backend     │
        │ (Nginx serve │   │ (FastAPI)   │
        │  static build)│  │  endpoints  │
        └──────────────┘   └─────────────┘
                           │
                           ▼
                 ┌────────────────────┐
                 │  Model artifacts    │
                 │ model.pkl, vectorizer.pkl │
                 └────────────────────┘

Tech Stack

  • Frontend: React (Hooks), Axios, plain CSS (dark theme)
  • Backend: FastAPI, Uvicorn, Pydantic
  • ML: scikit-learn (LinearSVC + TfidfVectorizer)
  • Deployment: Docker, docker-compose, Nginx

Installation (developer/local)

Prerequisites:

  • Node.js (v16+ / v18 recommended)
  • Python 3.11+
  • Docker & Docker Compose (optional for containerized run)
  1. Clone repository
git clone <your-repo-url> inbox-intelligence
cd "inbox-intelligence"
  1. Backend (local dev)
cd backend
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
# source .venv/bin/activate

pip install -r requirements.txt
# Run development server
uvicorn app:app --reload --port 8000

Open http://localhost:8000/docs to view the interactive API docs.

  1. Frontend (local dev)
cd ../frontend
npm install
npm start

Open http://localhost:3000 (development server).

  1. Full stack with Docker Compose

From repository root:

# Build and start everything
docker-compose up --build

# Open UI via the reverse proxy (Nginx):
# http://localhost (port 80)

# Stop
docker-compose down

Notes:

  • The frontend calls the backend at http://localhost:8000 in development. When served through Nginx, the proxy routes API calls to the backend service.

API Quick Example

POST /predict

Request:

{
  "text": "Your invoice #12345 is overdue. Please remit payment ASAP."
}

Response:

{
  "label": "high_priority",
  "confidence": 1.0
}

POST /suggest_reply

Request:

{
  "label": "high_priority"
}

Response:

{
  "suggested_reply": "Thank you for bringing this to my attention. I will prioritize this and get back to you shortly."
}

Future Improvements

  • Add probability calibration for meaningful confidence values
  • Support email subject, sender parsing and richer metadata
  • Add authentication and per-user settings
  • Batch processing & saved histories
  • Improve ML model (more data, transformer-based classifier)
  • A/B testing and model versioning
  • Light/dark theme toggle and keyboard shortcuts

Enjoy — open http://localhost:3000 and try pasting an email into the app.

About

AI-powered Email Classifier with Reply Generator | FastAPI + React + scikit-learn | ML-based classification (high_priority/normal/spam) + auto-reply suggestions | Docker + Nginx production-ready | Full-stack ML project

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages