The service has encountered an error while checking the health of the Streamlit app

I read similar posts with this error.
So can anyone check if my app is crashing due to memory usage or resource limitations or is it something else?
There isn’t any big files in github repo, but the code does generate a cosine similarity matrix shape of 14,210 x 14,210.
Any help is appreciated.

Hey @ftanveer,

Here’s a graph of your app’s memory usage over the past week. It does look like the memory usage has been spiking, which likely caused those error messages/crashes.

1 Like

Thanks a lot Caroline, the webapp is now able to run. I reduced the main database to reduce the load.So the cosine similarity matrix is now 5000 x 5000. I would have liked to run the 14,210 x 14,210 for better movie recommendations but it is okay.

Hey @ftanveer :wave:

You could also not reduce the main database, and instead use caching when loading your models so that they are loaded into memory just once:

1 Like

Thanks for the suggestion. I used the cache like below and it already helped alot, but not sure if I could optimize my code further or I am not properly caching my matrix.


My code is here: