1p / src /pages /__init__.py
pythoneerHiro's picture
Upload 54 files
4585d4c verified
raw
history blame
646 Bytes
import streamlit as st
def initApp():
# Import here to avoid top-level circular import issues with Streamlit
from app import App
# If an App instance exists in session, reuse it. Otherwise create a fresh one.
if 'app' not in st.session_state:
st.session_state.app = App()
else:
# Ensure the session-backed fields are synchronized into the live App
try:
st.session_state.app.load_from_session()
except Exception:
# If loading fails, recreate a fresh App to avoid stale state
st.session_state.app = App()
return st.session_state.app
app = initApp()