Is there a way to persist Gradio’s gr.State()
externally in a way that makes it work:
- across deploys
- across replicas
- across sessions
Our use case is launching a prototype chatbot for internal use, but the limitation on state being stored per-session in memory causes the following problems:
- the app cannot have more than one replica running at a time, as if traffic goes to “the other instance”, it has no state and the chat is reset
- whenever the app is deployed, state is reset for all users
- whenever a user refreshes, state is reset
Ideally, there would be a way to persist gr.State
in some external datastore (e.g. Redis, DB, even a just a cookie could work), or swap it out for another object with an appropriate interface.