Streamlit app with PyTorch/HuggingFace Transformers crashes when deployed to Heroku

Hi everyone! :wave:

My very first thread - it’s great to be here! :slight_smile:

I’ve an issue with a Streamlit app leveraging Pytorch with the distilbart-mnli-12-3 HuggingFace model.

I can’t seem to deploy it correctly on Heroku. I’ve tried various configs but once deployed the app crashes all time. Here’s the log trace I got from Heroku:

It looks like the app is crashing due to memory issues, the error being:

1. at=error code=H10 desc="App crashed" method=GET path="/healthz" request_id=54a25884-8fba-4c36-ad08-441237858746 fwd="" dyno= connect= service= status=503 bytes= protocol=https

Here’s the python code:

If needs be, I’ve also pasted all the files related to the Heroku deployment including the python file and the requirements.txt in this repo:

Thanks in advance for your help! :pray: