Spaces:
Build error
Build error
| 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() |