App crashing on second run, halfway through image detection

I’m baffled and hoping for some help. I’ve got a streamlit app to detect vacant parking spaces in short video clips from a live youTube stream. It’s running locally no problem, so I’ve deployed it to streamlit sharing.

Here’s my gitHub repo for reference: Parking_vacancy

When I run the option in my app “Live data” the first time, it works great. This downloads trained weights and runs detect with Mask R-CNN on frames from the video.
When I re-run the app and process live data again, it crashes halfway through the image detection process. Not at the beginning, but somewhere in the middle (200ish of 500ish frames).

I suspect this somehow has to do with either caching or running our of system resources, but don’t know enough to figure it out.

Here’s the log from the manager. You can see the app was rebooted (top lines), then run once. Then again (repeated warnings from tensor flow). Then it crashes with no apparent error besides

[manager] Python dependencies were installed from /app/parkingspot_vacancy/src/requirements.txt using pip.
[manager] Processed dependencies!
2021-06-03 04:36:31.036 An update to the [server] config option section was detected. To have these changes be reflected, please restart streamlit.
2021-06-03 04:36:32.399128: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-06-03 04:36:32.399175: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-06-03 04:36:34.339 Generating new fontManager, this may take some time...
2021-06-03 04:58:08.669 From /home/appuser/venv/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:5049: calling gather (from tensorflow.python.ops.array_ops) with validate_indices is deprecated and will be removed in a future version.
Instructions for updating:
The `validate_indices` argument has no effect. Indices are always validated on CPU and never validated on GPU.
2021-06-03 04:58:10.442 From /home/appuser/venv/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py:602: calling map_fn_v2 (from tensorflow.python.ops.map_fn) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Use fn_output_signature instead
2021-06-03 04:58:10.479957: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-06-03 04:58:10.480011: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-06-03 04:58:10.480040: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (localhost): /proc/driver/nvidia/version does not exist
2021-06-03 04:58:12.478089: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-06-03 04:58:13.084727: I tensorflow/core/platform/profile_utils/cpu_utils.cc:114] CPU Frequency: 2199995000 Hz
[manager] Streamlit server consistently failed status checks
[manager] Please fix the errors, push an update to the git repo, or reboot the app.