Skip to content

Latest commit

 

History

History
269 lines (209 loc) · 6.2 KB

File metadata and controls

269 lines (209 loc) · 6.2 KB

🚀 Quick Start Guide

Get the AI Email Summarizer running in under 5 minutes!

Prerequisites

  • Python 3.9+ (Python 3.13+ recommended)
  • Git
  • Basic terminal knowledge

Installation

1. Clone the Repository

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

2. Set Up Python Environment

# Create virtual environment
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate  # macOS/Linux
# OR
venv\Scripts\activate  # Windows

3. Install Dependencies

pip install -r requirements.txt

Running the Application

Start Backend Server

# Make sure virtual environment is active
source venv/bin/activate

# Start FastAPI server
uvicorn backend.main:app --reload --port 8080

✅ Backend will be available at: http://localhost:8080

Start Frontend (New Terminal)

# In a new terminal, activate environment
source venv/bin/activate

# Start Streamlit app
streamlit run frontend/streamlit_app.py

✅ Frontend will be available at: http://localhost:8501

Testing the Application

1. API Health Check

Visit: http://localhost:8080/health Expected response: {"status": "healthy", "message": "Email Summarizer API is running"}

2. API Documentation

Visit: http://localhost:8080/docs Interactive Swagger documentation for testing API endpoints

3. Web Interface

Visit: http://localhost:8501

  • Try the sample email thread in the sidebar
  • Paste your own email content
  • Test different summary modes

Sample API Usage

Summarize Email

curl -X POST "http://localhost:8080/api/summarize" \
     -H "Content-Type: application/json" \
     -d '{
       "content": "Your email content here...",
       "source": "manual",
       "summary_type": "concise"
     }'

Extract Action Items

curl -X POST "http://localhost:8080/api/extract-actions" \
     -H "Content-Type: application/json" \
     -d '{
       "content": "Your email content here...",
       "source": "manual"
     }'

What's Next?

  1. Chrome Extension: Load the extension from frontend/chrome_extension/
  2. Docker: Run with docker-compose up
  3. Production: Deploy to cloud with provided configurations
  4. Customization: Modify AI models in backend/models/

Troubleshooting

Common Issues

Port Already in Use

# Find process using port 8080
lsof -i :8080
# Kill the process
kill -9 <PID>

Dependencies Not Installing

# Upgrade pip first
pip install --upgrade pip
# Then install requirements
pip install -r requirements.txt

Virtual Environment Issues

# Remove and recreate
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Need Help?

  • 📖 Check the main README.md for detailed documentation
  • 🐛 Report issues on GitHub
  • 💡 Suggest features through GitHub issues

Happy summarizing! 📧✨

curl -X POST "http://localhost:8000/api/health"
  1. Chrome Extension (Development):
    • Open Chrome > Extensions > Developer mode
    • Click "Load unpacked" > Select frontend/chrome_extension/
    • Visit Gmail or Outlook and test the extension

📁 Project Structure

email_summarizer/
├── backend/                 # FastAPI backend
│   ├── main.py             # FastAPI app entry point
│   ├── api/                # API routes and schemas
│   ├── models/             # AI models (summarizer, parser)
│   ├── core/               # Configuration
│   └── utils/              # Utility functions
├── frontend/               # Frontend applications
│   ├── streamlit_app.py    # Streamlit web app
│   └── chrome_extension/   # Chrome extension
├── requirements.txt        # Python dependencies
├── docker-compose.yml      # Docker setup
└── README.md              # Detailed documentation

🧪 Testing

Run basic tests:

# Install test dependencies
pip install pytest pytest-asyncio

# Run tests
python -m pytest tests/ -v

🔧 Configuration

Environment Variables

Create a .env file in the project root:

ENVIRONMENT=development
SUMMARIZATION_MODEL=facebook/bart-large-cnn
MAX_INPUT_LENGTH=1024
REDIS_URL=redis://localhost:6379

Model Configuration

  • Default model: facebook/bart-large-cnn (mock implementation)
  • To use real models, uncomment the model loading code in backend/models/summarizer.py
  • Download models with: python scripts/download_model.py

🚢 Docker Deployment

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Services:

🔍 Troubleshooting

Common Issues

  1. Backend not starting:

    • Check Python version: python3 --version (requires 3.8+)
    • Ensure virtual environment is activated
    • Check port 8000 isn't in use: lsof -i :8000
  2. Streamlit connection error:

    • Ensure backend is running first
    • Check backend URL in streamlit app (should be localhost:8000)
  3. Chrome extension not working:

    • Check console for errors (F12 > Console)
    • Ensure you're on Gmail or Outlook
    • Verify backend is running and accessible
  4. Import errors:

    • Run from project root directory
    • Ensure all dependencies are installed: pip install -r requirements.txt

Debug Mode

Enable debug logging:

# In backend/core/config.py
LOG_LEVEL = "DEBUG"

📚 Next Steps

  1. Enhance AI Models:

    • Integrate real transformer models
    • Improve action item extraction
    • Add sentiment analysis
  2. Add Features:

    • User authentication
    • Summary history/database
    • Email client integrations
    • Mobile app
  3. Production Deployment:

    • Set up proper database (PostgreSQL)
    • Configure Redis caching
    • Deploy to cloud (AWS, GCP, Azure)
    • Set up CI/CD pipeline

💡 Tips

  • Use the sample email thread to test functionality
  • Check the API docs at http://localhost:8000/docs for detailed endpoint information
  • Monitor logs for debugging issues
  • The Chrome extension works best with Gmail in English

Happy coding! 🎉