Search code examples
pythondockergoogle-cloud-platformstreamlitgoogle-artifact-registry

Deploying a Streamlit Application via Google Cloud Platform with a Machine Learning Model continuously runs/connects


I created a Machine Learning Prediction tool with Streamlit and want to deploy to Google Cloud Platform (GCP) so the tool can be accessed via a domain. However the tool, when loaded via Google Cloud Run, is constantly 'Connecting'Connecting symbol in Streamlit App or 'Running' Running symbol in Streamlit App. This happens to the point where information required to be entered for the prediction to take place, cannot be entered

Initially I thought this was an issue with the caching so I introduced streamlit's caching features to no help. The following steps are used to deploy the streamlit app:

  1. Docker Image built (Locally, files accessed via GitHub) 1.1 At this point the tool works perfectly when a local container is created
  2. Docker Image pushed to a GCP Artifact Registry Repo
  3. Image deployed via GCP Cloud Run

Solution

  • Turns out it's a memory issue related to GCP. Make sure you're allocating more memory than the default