Deploying An ML Model on GCP
deployment
engineering
teardown
Introduction
As AI matures, more and more of its pipeline is becoming commoditized. Cloud services have made model deployment close to seamless. In this post, I present a step-by-step tutorial on deploying a ML model on Google Cloud Platform (GCP) by remixing a few well-documented components: Flask, Google App Engine (GAE), Google Cloud Storage, sklearn & AI Platform.
Just a few years ago, training model artifacts was new and exciting. Now, open source packages (Tensorflow, sklearn, etc) have made it accessible in just a few lines of code. In the same way, cloud services (GCP, Azure, AWS) make the deployment of models more straightforward than ever so we can move up the food chain onto the more challenging horizons: interpretability, adoption, A/B testing and more.
- Part I covers a simple Flask web micro-framework application that serves up some text locally, then deployed on the cloud. In this part, we set up a GCP project following Google's documentation. The output is a simple set of static text display.
- Part II locally trains an sklearn RandomForestRegressor model on a simple data set. The model artifact is then uploaded to Google Cloud Storage. A model is deployed on Google Cloud's AI Platform and locally called for predictions.
- Part III puts it all together. The web application from Part I is modified to take features as an input and then calls AI Platform to make a prediction and display it.