Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Web app with custom python image generation in background

Hello Community!

I am working on a web app. Currently it looks like this:

1. we run a streamlit app in a container

2. app user needs to download the filtered data from bigquery

3. after a user modify one of the slider the new image is generated from the data with a lot of computation in python (it takes around 10-30s). 

Our problem is that we have a lot of different settings that user can choose from using sliders and each time he needs to wait.

Do you have some ideas how can we change our architecture to reduce the time of generating these images? Or perhaps there is another way of accomplish this.

Thanks a lot!

Best regards

Maciej 

Solved Solved
0 4 407
1 ACCEPTED SOLUTION

Hi @MaciejMarek ,

The best way to get started is to use Cloud Run. Try https://cloud.run . It has great integration with Firebase. I can recommend you watch this talk from Next https://cloud.withgoogle.com/next/session-library?session=DEV100&utm_source=copylink&utm_medium=soci...

I'm sure there are plenty of tutorial on how to deploy a streamlit app on Cloud Run.

My first search https://edzoblaauw.medium.com/how-to-deploy-streamlit-applications-on-gcp-using-cloud-run-2f1eb4b23f...

View solution in original post

4 REPLIES 4

julien_bisconti
Google Developer Expert
Google Developer Expert

Hi @MaciejMarek ,

One thing that comes to mind is to work on the frontend workflow.

Let the user choose all the settings desired and then click on a submit button that asks the backend API to do the heavy computation. 

Another thing is to use a debounce function on the frontend. See an example with lodash: https://lodash.com/docs/4.17.15#debounce

I hope it helps, let us know how it goes,

Julien

Hi Julien thanks for your answer,

Can you propose sth for the backend? Type of service like FaaS, IaaS. If possible if you could propose a service from GCP that will fit for the backend of this kind of solution that would be fantastic!

Maciej

Hi @MaciejMarek ,

The best way to get started is to use Cloud Run. Try https://cloud.run . It has great integration with Firebase. I can recommend you watch this talk from Next https://cloud.withgoogle.com/next/session-library?session=DEV100&utm_source=copylink&utm_medium=soci...

I'm sure there are plenty of tutorial on how to deploy a streamlit app on Cloud Run.

My first search https://edzoblaauw.medium.com/how-to-deploy-streamlit-applications-on-gcp-using-cloud-run-2f1eb4b23f...

Hi @MaciejMarek ,

One thing that comes to mind is to work on the frontend workflow.

Let the user choose all the settings desired and then click on a submit button that asks the backend API to do the heavy computation.  good job

Top Solution Authors