How to Deploy ML Flask app to Google Cloud Platform

How to Deploy ML Flask app to Google Cloud Platform

Deploying ML Flask app to Google Cloud Platform

In this tutorial we will learn how to deploy a machine learning web App (flask App) to Google Cloud Platform using App Engine.

You will need to sign up to Google Cloud Console,
You can use the Free Trial Version.

Github Code:

28 thoughts on “How to Deploy ML Flask app to Google Cloud Platform

  1. This is an excellent video ….. very useful , clear and most informative ….. I found this video most helpful …. Thank you very much for posting this amazing video …. thanks a ton 🙏🏻

  2. Hello, i am getting this error
    ERROR: ( Error Response: [8] The region does not have enough resources available to fulfill the request. Please try again later.

  3. getting this error help me fix this

    Updating service [default] (this may take several minutes)…failed.
    ERROR: ( Error Response: [13] Flex operation projects/spammlapp/regions/asia-south1/operations/f046fc72-a267-4c2b-94d9-cac80d4e21f5 error [INTERNAL]: An internal error occurred
    while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2020-06-16T06:49:28.616Z1594.ow.14: Deployment Manager operation spammlapp/operation-1592290169203-5a82df1e
    a2cc9-aac60a16-8174e608 errors: [code: "RESOURCE_ERROR"
    location: "/deployments/aef-default-20200616t121905/resources/aef-default-20200616t121905"
    message: "{"ResourceType":"compute.beta.regionAutoscaler","ResourceErrorCode":"403","ResourceErrorMessage":{"code":403,"errors":[{"domain":"usageLimits","message":"Exceeded
    limit 'QUOTA_FOR_INSTANCES' on resource 'aef-default-20200616t121905'. Limit: 8.0","reason":"limitExceeded"}],"message":"Exceeded limit 'QUOTA_FOR_INSTANCES' on resource 'aef-defa
    ult-20200616t121905'. Limit: 8.0","statusMessage":"Forbidden","requestPath":"","httpMetho

  4. Hi . I am getting error here.

            return render_template('results.html',prediction = my_prediction, comment=comment)

    as {
    "resource": "file:///home/kumar_navesh/SpaMLApp/",
    "owner": "file:///home/kumar_navesh/SpaMLApp/",
    "severity": 1,
    "message": "unindent does not match any outer indentation level",
    "source": "pyflakes",
    "startLineNumber": 42,
    "startColumn": 91,
    "endLineNumber": 42,
    "endColumn": 182

  5. What you have created is very beneficial for beginners. I was able to deploy it on the GCP on my first attempt and it gave me so much confidence. Thanks for sharing and keep up the good work!

  6. How can I fix this problems?

    DEBUG: ( Error Response: [9]

    Application startup error:/bin/sh: 1: exec: gunicorn: not found

  7. Very useful tutorial!! The voice is very unclear unfortunately. But the step-by-step go through is just self-explanatory.

  8. when I try to deploy your project , it says:
    Google Cloud Platform – Your deployment has failed to become healthy in the allotted time and therefore was rolled back ,
    how to fix that please?

  9. Hi, I followed same files of yours and i am getting this error please help , Error: Server Error

    The server encountered an error and could not complete your request.

    Please try again in 30 seconds.

  10. Hi. I followed this video but getting following error.
    Can You please help?
    Traceback (most recent call last):

    File "/env/lib/python3.6/site-packages/gunicorn/", line 583, in spawn_worker


    File "/env/lib/python3.6/site-packages/gunicorn/workers/", line 129, in init_process


    File "/env/lib/python3.6/site-packages/gunicorn/workers/", line 138, in load_wsgi

    self.wsgi =

    File "/env/lib/python3.6/site-packages/gunicorn/app/", line 67, in wsgi

    self.callable = self.load()

    File "/env/lib/python3.6/site-packages/gunicorn/app/", line 52, in load

    return self.load_wsgiapp()

    File "/env/lib/python3.6/site-packages/gunicorn/app/", line 41, in load_wsgiapp

    return util.import_app(self.app_uri)

    File "/env/lib/python3.6/site-packages/gunicorn/", line 350, in import_app


    ModuleNotFoundError: No module named 'main'

    [2018-11-14 12:54:35 +0000] [7] [INFO] Worker exiting (pid: 7)

    [2018-11-14 12:54:35 +0000] [1] [INFO] Shutting down: Master

    [2018-11-14 12:54:35 +0000] [1] [INFO] Reason: Worker failed to boot.

Leave a Reply

Your email address will not be published. Required fields are marked *