Within the streamlit.cache() decorator you’ll get better performance if you use allow_output_mutation=True because this means Streamlit just uses the same copy of the model in memory, rather than reloading when it’s re-run.