Code Monkey home page Code Monkey logo

imail's Introduction

IMail

IMail

Frontend

  1. Install Node JS
  2. Install the required modules npm install
  3. Run frontend on port 3000 npm run dev

Additional steps before runing:

  1. Register as Google developer and create and application and enable Gmail API access to the application Gmail API Quickstart
  2. Replace the Client ID and API key in the gmail_controller.js in public/js/controllers

Note: All requests send to IRIS at port 52774, change it before you run the application You will need to change \Frontend React JS\gmail\public\js\controllers\gmail_controller.js it is referencing http://localhost:52774/api/email... to change port and host if necessary

IRIS

  1. Create a Namespace (IMAIL)
  2. Import EmailIntel.xml which includes all classes and interoperability.
  3. Create a Web appication (/api/email/) in IRIS - set Dispatch Class = "Email.RESTOperations" (RESTOperations.cls)

Google Colab

  1. Open the \IMAIL\Email_Intelligence.ipynb on Google Colab (https://colab.research.google.com/). Import into Colab (Upload)
  2. The training required dataset (Enron and Apache) is available at Google Drive

Upload the dataset to Google drive and change the pd.read_csv() to your directory in Google Drive (recommanded)

  1. Select Runtime as Python 3 and GPU.
  2. Run all code cells in order (important) up until the Evaluation section (if you just want to get the model file, don't have to do any evalutaion of the model)

Instructions/explainations of each cell are provided in the ipynb file.

Additional steps may require if you want to use Google Cloud Bucket

Model Serving

  1. Install Python 3.6 (It's very important that you have installed the correct version of Python)

  2. Install all required libraries

    pip install tensorflow

    pip install tensorflow-hub

    pip install flask

    pip install bert

    pip install pandas

    pip install scikit-learn

  3. have your trained model in the correct folder and change the OUTPUT_DIR in the serving.py to your location

Recommond to download BERT base model to local as well so that you don't have to re-download the model every time it runs.

Download every files in the Google Bucket after the initial training, for example:

checkpoint

graph.pbtxt

model.ckpt-4503.data-00000-of-00001

model.ckpt-4503.index

model.ckpt-4503.meta

  1. Execute the serving.py It will start listening on port 5000

Serving Route:

  1. POST to http://localhost:5000/predict

Make prediction

Request body contains json with the following format:

{ "raw": "String that you want to classify" }

  1. POST to http://localhost:5000/train

Incremental training

Request body contains json with the following format:

{ "text":["The phone I was purchasing yesterday on the website got a great discount","Purchasing phones from our website now and you can get a great discount"], "spam":[0,1] }

imail's People

Contributors

peteoh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.