Skip to content

🤖 AI-powered email thread summarizer with FastAPI backend, Streamlit frontend, and Chrome extension

Notifications You must be signed in to change notification settings

arjungop/ai-email-summarizer

Repository files navigation

📧 AI-Powered Email Summarizer

FastAPI Streamlit Python Docker

A modern productivity tool that transforms lengthy email threads into concise, actionable summaries with AI-powered action item extraction.

Email Summarizer Demo

✨ Features

🤖 AI-Powered Summarization - Transform long email threads into bullet-point summaries
📋 Action Item Extraction - Automatically identify tasks, deadlines, and assignees
🎯 Smart Parsing - Clean HTML, remove signatures, and extract key information
🔌 Multiple Interfaces - Streamlit web app, Chrome extension, and REST API
Fast & Lightweight - Built with FastAPI for high performance
🐳 Docker Ready - Easy deployment with Docker Compose

🚀 Quick Start

Option 1: One-Command Setup

git clone https://github.com/arjungop/ai-email-summarizer.git
cd ai-email-summarizer
./setup.sh

Option 2: Manual Setup

# Clone and setup
git clone https://github.com/arjungop/ai-email-summarizer.git
cd ai-email-summarizer

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Start the Application

# Terminal 1: Start Backend API
source venv/bin/activate
uvicorn backend.main:app --reload --port 8080

# Terminal 2: Start Frontend
streamlit run frontend/streamlit_app.py

Access the Application

🎯 Project Overview

Mission: Reduce time spent reading long email threads by automatically generating intelligent summaries and extracting actionable insights.

Core Capabilities

  • Email Thread Analysis - Parse and clean email content from various sources
  • Intelligent Summarization - Generate concise bullet-point summaries
  • Action Item Detection - Extract tasks, deadlines, and assignments
  • Multi-Platform Support - Web app, browser extension, and API access

🛠️ Tech Stack

Backend

  • FastAPI - Modern, fast web framework for building APIs
  • Python 3.8+ - Core programming language
  • Pydantic - Data validation and serialization
  • Uvicorn - ASGI server for running FastAPI

AI/ML Components

  • Transformers Library - Hugging Face transformers for model integration
  • LLaMA 3 or GPT-J - Open-source large language models for summarization
  • PyTorch - Deep learning framework
  • Sentence-Transformers - For text embeddings and similarity

Frontend Options

Choose one based on your preference:

Option 1: Chrome Extension

  • HTML/CSS/JavaScript - Core web technologies
  • Chrome Extension APIs - For browser integration
  • Webpack - Module bundler
  • Manifest V3 - Latest Chrome extension format

Option 2: Streamlit Web App

  • Streamlit - Python web app framework
  • Streamlit Components - For custom UI elements

Option 3: React Web App

  • React.js - Frontend library
  • TypeScript - Type-safe JavaScript
  • Tailwind CSS - Utility-first CSS framework
  • Axios - HTTP client for API calls

Database & Storage

  • SQLite - Lightweight database for storing summaries
  • Redis (optional) - Caching for improved performance

DevOps & Deployment

  • Docker - Containerization
  • Docker Compose - Multi-container orchestration
  • Nginx - Reverse proxy and load balancer
  • GitHub Actions - CI/CD pipeline

📋 Prerequisites

Required Knowledge

  • Python Programming - Intermediate level
  • Web Development Basics - HTML, CSS, JavaScript
  • API Development - REST API concepts
  • Machine Learning Basics - Understanding of NLP and transformers

System Requirements

  • Python 3.8+
  • Node.js 16+ (if building React frontend or Chrome extension)
  • Git for version control
  • 4GB+ RAM (for running language models)
  • GPU (optional but recommended for faster inference)

🚀 Getting Started

1. Environment Setup

# Clone the repository
git clone <your-repo-url>
cd email_summarizer

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Model Setup

# Download and cache the language model
python scripts/download_model.py

3. Run the Backend

# Start the FastAPI server
uvicorn main:app --reload --port 8000

4. Frontend Setup (Choose One)

Streamlit Option:

streamlit run frontend/streamlit_app.py

Chrome Extension Option:

cd frontend/chrome_extension
npm install
npm run build
# Load unpacked extension in Chrome

📁 Project Structure

email_summarizer/
├── backend/
│   ├── main.py                 # FastAPI application
│   ├── models/
│   │   ├── summarizer.py       # ML model wrapper
│   │   └── email_parser.py     # Email parsing logic
│   ├── api/
│   │   ├── routes.py           # API endpoints
│   │   └── schemas.py          # Pydantic models
│   ├── core/
│   │   ├── config.py           # Configuration settings
│   │   └── dependencies.py     # Dependency injection
│   └── utils/
│       ├── text_processing.py  # Text preprocessing utilities
│       └── action_extraction.py # Action item extraction
├── frontend/
│   ├── streamlit_app.py        # Streamlit frontend
│   ├── chrome_extension/       # Chrome extension files
│   │   ├── manifest.json
│   │   ├── popup.html
│   │   ├── popup.js
│   │   └── content.js
│   └── react_app/             # React frontend (optional)
├── models/                     # Downloaded model files
├── data/                       # Sample data and datasets
├── tests/                      # Unit and integration tests
├── docker/                     # Docker configuration
├── scripts/                    # Utility scripts
├── requirements.txt            # Python dependencies
├── docker-compose.yml          # Multi-container setup
└── README.md                   # This file

🔧 Key Features Implementation

1. Email Thread Parsing

  • Extract email metadata (sender, timestamp, subject)
  • Clean HTML and formatting
  • Identify email thread structure

2. AI Summarization

  • Process email content through LLM
  • Generate bullet-point summaries
  • Maintain context across thread

3. Action Item Extraction

  • Use NER (Named Entity Recognition) for dates and names
  • Pattern matching for action verbs
  • Extract deadlines and commitments

4. API Endpoints

POST /api/summarize           # Summarize email thread
GET  /api/summary/{id}        # Retrieve summary by ID
POST /api/extract-actions     # Extract action items only
GET  /api/health             # Health check

🧠 Learning Path

Phase 1: Foundation (Week 1-2)

  1. Python & FastAPI

    • FastAPI tutorial and documentation
    • RESTful API design principles
    • Pydantic for data validation
  2. NLP Basics

    • Transformers library documentation
    • Hugging Face model hub exploration
    • Text preprocessing techniques

Phase 2: Core Development (Week 3-4)

  1. Model Integration

    • Loading and using pre-trained models
    • Prompt engineering for summarization
    • Performance optimization
  2. Backend Development

    • API endpoint implementation
    • Error handling and validation
    • Database integration

Phase 3: Frontend Development (Week 5-6)

  1. Choose Your Frontend

    • Streamlit for rapid prototyping
    • Chrome extension for browser integration
    • React for full web application
  2. Integration

    • API consumption
    • User interface design
    • Error handling and feedback

Phase 4: Enhancement (Week 7-8)

  1. Advanced Features

    • Caching and performance optimization
    • User authentication
    • Summary customization
  2. Deployment

    • Docker containerization
    • Cloud deployment (AWS, GCP, Azure)
    • CI/CD pipeline setup

📚 Resources

Documentation

Models

Tutorials

  • FastAPI + ML Model Deployment
  • Chrome Extension Development
  • Streamlit for ML Applications
  • Docker for Python Applications

🎯 Success Metrics

  • Accuracy: Summary captures key points (>90%)
  • Speed: Processing time <5 seconds per thread
  • User Experience: Clean, intuitive interface
  • Reliability: 99%+ uptime for API

🚀 Future Enhancements

  • Multi-language support
  • Email client integrations (Gmail, Outlook)
  • Custom summary templates
  • Team collaboration features
  • Analytics dashboard
  • Mobile app development

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details


Happy Coding! 🚀

This project combines modern web development, AI/ML, and practical productivity solutions - perfect for building your full-stack development skills while creating something genuinely useful.

About

🤖 AI-powered email thread summarizer with FastAPI backend, Streamlit frontend, and Chrome extension

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published