Spaces:
Sleeping
Sleeping
Download src/utils/session_state.py from faseehsandhu/Digitalytics: direct link, hf CLI and curl.
- Browser
- Download file 649 Bytes
-
https://huggingface.co/spaces/faseehsandhu/Digitalytics/resolve/main/src/utils/session_state.py
- Command line
-
hf download hf://spaces/faseehsandhu/Digitalytics/src/utils/session_state.py
-
curl -L -o session_state.py https://huggingface.co/spaces/faseehsandhu/Digitalytics/resolve/main/src/utils/session_state.py
649 Bytes
| import streamlit as st | |
| def get_session_state(): | |
| """Get the current session state or create a new one if it doesn't exist.""" | |
| if 'data_dictionaries' not in st.session_state: | |
| st.session_state.data_dictionaries = [] | |
| if 'user_uploads' not in st.session_state: | |
| st.session_state.user_uploads = [] | |
| if 'chat_history' not in st.session_state: | |
| st.session_state.chat_history = [] | |
| return st.session_state | |
| def clear_session_state(): | |
| """Clear the session state for a fresh start.""" | |
| st.session_state.data_dictionaries.clear() | |
| st.session_state.user_uploads.clear() | |
| st.session_state.chat_history.clear() |