Skip to content

We train and deploy a serverless Sentiment Analysis API to GCP by using BERT (DistilBERT), TensorFlow, FastAPI, Python, Google AI Platform Training, Google Storage, Cloud Build, Cloud Container Registry, and Cloud Run.

License

Notifications You must be signed in to change notification settings

SaschaHeyer/Sentiment-Analysis-GCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unexpected easy Sentiment Analysis using BERT on Google Cloud Platform

This repository contains the demo code for the DoiT blog article.

For a demo head over to https://sentiment.practical-machine-learning.com/

What is covered

As part of this article, we train and deploy a serverless Sentiment Analysis API to GCP by using BERT, TensorFlow, FastAPI, Python, Google AI Platform Training, Google Storage, Cloud Build, Cloud Container Registry, and Cloud Run.

Training

The training folder contains the logic required to train the sentiment model.

Adapt training/cloudbuild.yaml to your GCP environment.

To build the training image used for AI Platform run

gcloud builds submit --config cloudbuild.yaml

To start the training run

export JOB_NAME=bert_$(date +%Y%m%d_%H%M%S)
export IMAGE_URI=gcr.io/machine-learning-sascha/sentiment-training:latest

export REGION=us-west1

gcloud config set project machine-learning-sascha 

gcloud ai-platform jobs submit training $JOB_NAME \
  --region $REGION \
  --master-image-uri $IMAGE_URI \
  --scale-tier=BASIC_GPU

Prediction

Adapt prediction/cloudbuild.yaml to your GCP environment.

Deploy the application to Cloud Run using Cloud Build

gcloud builds submit --config cloudbuild.yaml

About

We train and deploy a serverless Sentiment Analysis API to GCP by using BERT (DistilBERT), TensorFlow, FastAPI, Python, Google AI Platform Training, Google Storage, Cloud Build, Cloud Container Registry, and Cloud Run.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published