- Model Function
Explore deploying machine learning models as serverless functions on Google Cloud Platform. Learn to set up Cloud Functions to serve logistic regression predictions, manage dependencies, retrieve models from cloud storage, and use caching to improve response times for scalable, real-time model inference.
We'll cover the following...
We can now set up a Cloud Function that serves logistic regression model predictions over the web. We’ll build on the Flask example that we explored in this lesson and make a few modifications for the service to run on GCP.
Installing libraries
The first step is to specify the required Python libraries that we’ll need to serve requests in the requirements.txt file, as shown below.
We’ll also need Pandas to set up a dataframe for making the prediction, sklearn for applying the model, and cloud storage for retrieving the model object from GCS.
Implementing model function
The next step is to implement ...