Skip to content

This project is a web application built with Flask, which allows users to log in with their Google account, fetch Gmail messages, and classify them as "Important" or "Not Important" using a machine learning model from Hugging Face. The application uses Hugging Face models for classification and summarization of emails.

Notifications You must be signed in to change notification settings

dmunasingha/gmail_summarizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flask Gmail Classifier/Summarizer with Google Hugging Face

This project is a web application built with Flask, which allows users to log in with their Google account, fetch Gmail messages, and classify them as "Important" or "Not Important" using a machine learning model from Hugging Face. The application uses Hugging Face models for classification and summarization of emails.

Features

  • Google OAuth2 Login: Allows users to log in using their Google account.
  • Fetch Gmail Emails: Retrieves the most recent emails from the user's Gmail account.
  • Email Classification: Classifies emails into "Important" and "Not Important" categories using a Hugging Face model.
  • Email Summarization: Summarizes the email body to provide users with a quick overview.
  • Dashboard: Displays classified emails on the dashboard after logging in.

Prerequisites

Before running this project, make sure you have the following installed:

  • Python 3.x
  • Pip (Python package manager)

Installation

  1. Clone the repository:

    git clone https://github.com/dmunasingha/gmail_summarizer
    cd gmail_summarizer
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
  3. Activate the virtual environment:

    • On macOS/Linux:
      source venv/bin/activate
    • On Windows:
      venv\Scripts\activate
  4. Install the required dependencies:

    pip install -r requirements.txt

Google OAuth2 Setup

To use Google OAuth2, you will need to set up OAuth2 credentials through the Google Developer Console.

  1. Go to Google Developer Console.
  2. Create a new project or select an existing one.
  3. Enable the Gmail API for the project.
  4. Go to APIs & Services > Credentials, and create new OAuth2 credentials.
  5. Download the credentials.json file and place it in the root of the project directory.

Hugging Face Setup

If you're using a Hugging Face model for email classification, you need to install the Hugging Face transformers library and optionally set up an API key.

  1. Install Hugging Face transformers:

    pip install transformers
  2. Set up your Hugging Face API key (optional if using a local model):

    huggingface-cli login

Running the Application

  1. Start the Flask app:

    python app.py
  2. Open your browser and go to http://127.0.0.1:5000/.

  3. Log in with your Google account, and the application will fetch your Gmail messages and classify them.

File Structure

gmail_summarizer/
│
├── app.py                # Flask application
├── requirements.txt      # List of dependencies
├── credentials.json      # Google OAuth2 credentials (Do not share this file)
├── static/               # Static files (CSS, JS, images)
├── templates/            # HTML templates for Flask
│   ├── index.html
│   └── dashboard.html
└── .gitignore            # Git ignore file

Dependencies

  • Flask
  • Flask-OAuthlib
  • Google API Python Client
  • Hugging Face transformers
  • Requests

You can install the required dependencies using the following command:

pip install -r requirements.txt

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Dunith Munasingha: munasingha.dunith@gmail.com

About

This project is a web application built with Flask, which allows users to log in with their Google account, fetch Gmail messages, and classify them as "Important" or "Not Important" using a machine learning model from Hugging Face. The application uses Hugging Face models for classification and summarization of emails.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages