Skip to content

How To Deploy ML Models With Google Cloud Run

Learn how to deploy Machine Learning models with Google Cloud Run.

Learn how to deploy Machine Learning / Deep Learning models with Google Cloud Run. We build a simple app with TensorFlow and Flask, containerize it with Docker, and deploy it to Google Cloud Run.

You can find the code on GitHub:

1. Write App (Flask, TensorFlow)

  • The code to build, train, and save the model is in the test folder.
  • Implement the app in

2. Setup Google Cloud

  • Create new project
  • Activate Cloud Run API and Cloud Build API

3. Install and init Google Cloud SDK

4. Dockerfile, requirements.txt, .dockerignore

5. Cloud build & deploy

gcloud builds submit --tag<project_id>/<function_name>
gcloud run deploy --image<project_id>/<function_name> --platform managed


  • Test the code with test/

FREE VS Code / PyCharm Extensions I Use

鉁 Write cleaner code with Sourcery, instant refactoring suggestions: Link*

PySaaS: The Pure Python SaaS Starter Kit

馃殌 Build a software business faster with pure Python: Link*

* These are affiliate link. By clicking on it you will not have any additional costs. Instead, you will support my project. Thank you! 馃檹