I have a large image classification model (859 MB) that I want to deploy in streamlit, but since the large model can’t be cloned by streamlit cloud via github, I added it as a release in the repository and added it in requirements.txt like the following:
Which is the same way I would add a spacy model to requirements.txt.
Apparently this causes an error while instaling requiments on streamlit cloud, any idea on what causes the problem?
On Streamlit Cloud, each app is allocated 1GB of RAM. Large image classification models will exceed that limit and crash the app. I would suggest hosting the model inference process on another provider and make API calls to it from your Streamlit Cloud app.
Hello @snehankekre, thank you so much for your response.
So I tried what you suggested by building an API with FastAPI and tried to deploy ot with Heroku.
However, I have added my large model (859 MB) to the repository via GitHub LFS which isn’t supported by Heroku by default and if it was it will basically saturate the slug size since the limit is 500MB.
I am not sure if I should ask this here but what I did as a solution was to request the model at the top of the app and use it to return the prediction like the following:
The solution that I found is to reduce my model size by converting it to tflite like the following, and using it afterwards to classify the input images in an API:
The model size was reduced to 72MB, which was added to the size of the dependencies without saturating the slug size in Huroku, hence the api was deployed successfully.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.