Streamlit app stops working after ~40 mins

I have a streamlit app which extracts text from PDFs and translates them into another language. The app is deployed on the streamlit cloud. It works fine when the PDF is small (~300 pages) but when I try to process documents which are longer (~1000 pages) it just stops executing after about 700 pages processing. Any help with this would be appreciated.

App link:https://translator-lq4ez4xhgnu9hpvageemnu.streamlit.app/

Hi @musa_khawaja Streamlit cloud offers only 1gb of memory space.

Is there any workaround to this?