A Chrome Extension that integrates Machine Learning directly in the browser using TensorFlow.js to classify Gmail emails as important or not important, automatically highlighting important ones with a subtle red tint.
This project demonstrates Edge Machine Learning, bringing intelligence to the client-side using a model built and converted from TensorFlow/Keras.
- Automatically runs in Gmail (mail.google.com)
- Loads a pre-trained TensorFlow.js model and tokenizer
- For each email, concatenates sender and subject, predicts with the model
- If the model output is 0, marks the email as important (light red background)
This extension uses Parcel to bundle the content script.
- Go to https://nodejs.org
- Download the LTS (Long-Term Support) version.
- Run the installer
- After installation, open Terminal / Command Prompt and check:
node -v
npm -v
cd Chrome_extension
npm init -y
npm install @tensorflow/tfjs parcel
npm run build
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked" and select the
Chrome_extensionfolder
- Go to Gmail
- The extension will automatically classify emails in your inbox
- Emails predicted as important (model output 0) will have a light red background
π TECHLOOP-EDGEMLANDCHROMEEXTENSIONS/
β
β
βββ π Chrome_extension/ # Chrome Extension source folder
β βββ manifest.json # Chrome Extension configuration and permissions
β βββ content.js # Content script that runs on Gmail to classify emails
β βββ package.json # Dependencies and scripts needed to build or run the extension.
β βββ package-lock.json
β βββ π dist/ # Auto-generated folder after Parcel build
β β βββ content.js # Bundled optimized script used by Chrome
| | βββ π model/ # Additional copy of the model files
β βββ π model/ # Local copy of model files used by the extension, downloaded from the colab notebooks
β βββ model.json
β βββ group1-shard1of1.bin
β βββ model.h5
β βββ tokenizer_vocab.json
β
βββ π Colab Notebooks/ # Colab NoteBooks for the Classification Model
β βββ diabetes-practice.ipynb # Notebook to practice creating classification model
β βββ EmailClassifier.ipynb # Notebook to train and test the email classifier model
β
βββ π Data Sets/ # Data sets used for training the models
β βββ diabetes.csv # Diabetes data set for practice
β βββ emails.xlsx # Main data set for training the Email classifier
β
βββ README.md # Complete documentation for setup and usage