Using a Vertex AI endpoint to augment a simple web deploy deployment
Earlier this year I shared a story about deploying a Keras model using preprocessing layers in a simple, Flask-based web application. In this article I will show how to adapt that solution to replace the local invocation of the model with a Vertex AI endpoint. This shows how easy it is to deploy an existing Keras model in Vertex AI and how you can use a simple web framework to exercise this deployment.
The starting point: 100% local deployment in a Flask-based web application
To recap the starting point from the previous article, the 100% local Keras web deployment looks like this:
Here are the key elements of the deployment:
- Keras model saved on the local file system
- Flask server module that loads the saved Keras model, serves the web pages, and gets predictions from the model based on what the user enters in the
home.html: page where the user can enter characteristics of the property for which they want to get a prediction
show-prediction.html: web page to display the model’s prediction for the property
The goal: simple web application for Keras model deployed in a Vertex AI endpoint
Here’s what the updated solution looks like with the model being accessed from a Vertex AI endpoint rather than from the local file system:
The key elements that are changed in this updated deployment:
- The model is deployed to a Vertex AI endpoint
- The Flask server is updated to access the model via the Vertex AI endpoint
The following sections outline the steps required to update the application to use the Vertex AI endpoint.