Hitting memory limit of streamlit app

I persuaded that my app runs without any error on a local machine and tried to publish it on a streamlit cloud service, but faced with the following error:

[07:49:48] :exclamation: The service has encountered an error while checking the health of the Streamlit app: Get “http://localhost:8501/healthz”: read tcp> read: connection reset by peer
[07:49:48] :exclamation: Streamlit server consistently failed status checks
[07:49:48] :exclamation: Please fix the errors, push an update to the git repo, or reboot the app

Streamlit Support replied for my appeal and said that i have troubles with hiiting resource limits of streamlit cloud. Is there a solution for this problem? I noticed that this problem appears when i try to load very huge file (is about 7gb) - fasttext embeddings for my NLP models. Can you provide any solution for this problem. May be you can advice some methods not to download this file right into a memory of my hosted app?

Hi @DKazhekin! :wave:

You could either try exploring smaller FastText models, loading only the necessary embedding parts when needed, or storing the embeddings in cloud storage (like Google Cloud Storage or Amazon S3), and utilizing st.cache for faster loading.

Alternatively, since Streamlit Cloud has a 1GB RAM limit, you might want to consider deploying your app on platforms like GCP, AWS, to name a few. These platforms offer more memory and greater control over your app’s environment.

Feel free to reach out if you have any questions or want to discuss these options further!


And what is the simplest approach to use one of other platforms to host streamlit app with more RAM? Can you give may be a link to a tutorial :slight_smile: ?

If you’re solely considering the RAM route, as RAM is capped at 1GB on Streamlit Cloud, the main question would be: which platform(s) would you be allowed and most comfortable to engage with?


Truly speaking, my goal is to place my streamlit app in such a way that people can try out its functionality. There are no restrictions on the use of specific platforms. I only need a way to implement it as fast as possible, with the minimum of efforts, if there exists one ). My app is for educational purposes and it won’t attract a lot of traffic, i think)

If you need a quick and easy implementation, I suggest using Hugging Face’s Serverless Inference API. You can find more info about it in their docs.

This, I think, is the FastText model you’d need. This API call can be used into Streamlit Cloud without needing to migrate to another platform.

Let me know if you have any questions about implementing this – It is straightforward to do, but remember to put your HuggingFace token in st.secrets! :smiling_face: