garvitsachdeva commited on
Commit
066febe
·
1 Parent(s): f7e6177

diag: minimal 5-line app + disable usage stats — isolate Starting issue

Browse files
Files changed (2) hide show
  1. .streamlit/config.toml +3 -0
  2. streamlit_app.py +3 -63
.streamlit/config.toml CHANGED
@@ -4,3 +4,6 @@ port = 7860
4
  address = "0.0.0.0"
5
  enableCORS = false
6
  enableXsrfProtection = false
 
 
 
 
4
  address = "0.0.0.0"
5
  enableCORS = false
6
  enableXsrfProtection = false
7
+
8
+ [browser]
9
+ gatherUsageStats = false
streamlit_app.py CHANGED
@@ -1,65 +1,5 @@
1
- import sys, os, traceback
2
- from pathlib import Path
3
  import streamlit as st
4
 
5
- _root = Path(__file__).resolve().parent
6
-
7
- for _p in (str(_root), str(_root / "demo")):
8
- if _p not in sys.path:
9
- sys.path.insert(0, _p)
10
- os.chdir(str(_root))
11
-
12
- st.set_page_config(
13
- page_title="SpindleFlow RL",
14
- page_icon="⚡",
15
- layout="wide",
16
- initial_sidebar_state="collapsed",
17
- )
18
-
19
-
20
- @st.cache_resource(show_spinner="⏳ Loading SpindleFlow RL — first load ~30 s on CPU…")
21
- def _warm():
22
- """
23
- Pre-load every heavy module into sys.modules exactly once.
24
- cache_resource flushes the spinner to the browser BEFORE this runs,
25
- so the user sees feedback and Streamlit stays alive during the 30 s wait.
26
- Returns None on success, error string on failure.
27
- """
28
- try:
29
- import torch # noqa: F401
30
- import numpy # noqa: F401
31
- import gymnasium # noqa: F401
32
- import stable_baselines3 # noqa: F401
33
- import sb3_contrib # noqa: F401
34
- import sentence_transformers # noqa: F401
35
- import plotly # noqa: F401
36
- from env.spindleflow_env import SpindleFlowEnv # noqa: F401
37
- from env.state import EpisodeState # noqa: F401
38
- from env.specialist_registry import SpecialistRegistry # noqa: F401
39
- from orchestrator_widget import render_orchestrator # noqa: F401
40
- return None
41
- except Exception as exc:
42
- return traceback.format_exc()
43
-
44
-
45
- _err = _warm()
46
-
47
- if _err:
48
- st.error("SpindleFlow failed to import dependencies.")
49
- st.code(_err)
50
- else:
51
- _real_spc = st.set_page_config
52
- st.set_page_config = lambda *a, **kw: None
53
- _demo = _root / "demo" / "streamlit_app.py"
54
- try:
55
- exec(
56
- compile(_demo.read_text(encoding="utf-8"), str(_demo), "exec"),
57
- {"__file__": str(_demo), "__name__": "__main__"},
58
- )
59
- except SystemExit:
60
- pass
61
- except Exception as exc:
62
- st.error(f"SpindleFlow demo crashed: {exc}")
63
- st.code(traceback.format_exc())
64
- finally:
65
- st.set_page_config = _real_spc
 
 
 
1
  import streamlit as st
2
 
3
+ st.set_page_config(page_title="SpindleFlow RL", page_icon="⚡", layout="wide")
4
+ st.title("⚡ SpindleFlow RL")
5
+ st.info("System is up full demo loads on demand.")