Skip to content

My first step into AI and LLMs. Fine-tuned GPT2, built a contrived dataset, implemented asynchronous monitoring with Celery and built a full-stack mini email client. Think of it as a minimalistic Gmail with automatic response powered by GPT2.

Notifications You must be signed in to change notification settings

Olubusolami-R/intelligent-email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intelligent Email Auto-Response System

A scrappy but functional attempt at a smarter inbox, like Gmail, but with AI-powered auto-responses.


This repository contains code written in Python and JavaScript to build an intelligent email auto-response system. The backend was built using Python (Flask) with PostgreSQL, while the frontend was built with React. The model to be utilised is a fine-tuned version of the GPT2 LLM. Although there's still a lot of work to be done, I thoroughly enjoyed this project. It was a great deep dive into building practical AI with real-world constraints.

Getting Started: Pre-requisites and Local Development

Developers running this project should already have Python3, pip, PostgreSQL, Redis and Node installed on their local machines. All code in the backend follows the PEP 8 style guide. It is also recommended to run the project in a virtual environment. Instructions for setting up a virtual environment for your platform can be found in the Python docs.

Database Setup

Ensure PostgreSQL is running, then run the following commands on your terminal

psql autoresponse
psql autoresponse< autoresponse.psql

You can now check out the database tables using the following commands

psql autoresponse
\dt

Backend Setup

The following steps are needed to set-up the backend:

  1. Navigate to the backend folder
  2. Set up your virtual environment and activate it
  3. Run pip install requirements.txt on your terminal (still inside the backend folder and virtual environment)
  4. Run
export FLASKAPP=flaskr
export FLASKENV=development
flask run 

The project should be running on http://127.0.0.1:5000 on your computer. If you are running Windows locally, you can look for the equivalent of the commands for windows in the Flask documentation.

Celery Setup

Celery is a library which handles the asynchronous execution of the email polling and autoresponse features. You can start it up by running the following commands. Note: You need to navigate to the backend folder on 2 different terminals, and activate the virtual environment on both terminals.

On terminal 1, run:

celery -A app.celery worker --loglevel=info

On terminal 2, run:

celery -A app.celery beat --loglevel=info

If you did not see any errors, celery worker and beat should be working fine.

Frontend Setup

  1. Navigate to the frontend folder
  2. Run the following commands
npm install //run this only once to install the dependencies
npm start  //to run the project at any time

Your project should be up and running and looking like

picture

Challenges & Learnings

  • Fine-tuning GPT-2 on an 8GB laptop was tricky. I had to use Kaggle's free 30 hours per week of TPUs and GPUs for training.
  • Even after fine-tuning and downloading the fine-tuned model from Kaggle, I couldn’t fully integrate it with the backend due to the hardware limitation.
  • Built backend from scratch with Postgres, added async email polling and auto-responses with Celery.
  • Collaborated on frontend, handled deployment workflows, and iterated based on internal testing. Key skills gained: AI fine-tuning under constraints, async backend architecture, full-stack integration.

About

My first step into AI and LLMs. Fine-tuned GPT2, built a contrived dataset, implemented asynchronous monitoring with Celery and built a full-stack mini email client. Think of it as a minimalistic Gmail with automatic response powered by GPT2.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •