I would like to build a multipage streamlit app that uses a database (weaviate with langchain). The db object should be shared across all users and all pages so I only use one db instance (this instance loads a retriever model from langchain so uses a bit of RAM).
My approach
I tried using @st.cache_resource and outsourcing it into another file. So the same function get’s called by all pages:
Unfortunately this doesn’t work. Session state is also not usable because it is replicated for each user. Has anyone another idea what the correct approach would be?
Debug info
Streamlit version: 1.26.0
Python version: 3.10.12
Pipenv
OS version: Linux
Requirements file
(can append if needed, but I think it is not neccesary)