Spaces:
Runtime error
Runtime error
Commit ·
e05a5b9
1
Parent(s): e247c59
fix: use importlib to load demo app + streamlit config.toml
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .streamlit/config.toml +5 -15
- streamlit_app.py +10 -5
.streamlit/config.toml
CHANGED
|
@@ -1,16 +1,6 @@
|
|
| 1 |
-
[theme]
|
| 2 |
-
base = "dark"
|
| 3 |
-
primaryColor = "#00d4ff"
|
| 4 |
-
backgroundColor = "#0f0f1a"
|
| 5 |
-
secondaryBackgroundColor = "#151525"
|
| 6 |
-
textColor = "#e2e8f0"
|
| 7 |
-
font = "sans serif"
|
| 8 |
-
|
| 9 |
[server]
|
| 10 |
-
headless
|
| 11 |
-
port
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
[browser]
|
| 16 |
-
gatherUsageStats = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
[server]
|
| 2 |
+
headless = true
|
| 3 |
+
port = 7860
|
| 4 |
+
address = "0.0.0.0"
|
| 5 |
+
enableCORS = false
|
| 6 |
+
enableXsrfProtection = false
|
|
|
|
|
|
streamlit_app.py
CHANGED
|
@@ -1,16 +1,21 @@
|
|
| 1 |
import sys, os, traceback
|
| 2 |
import streamlit as st
|
| 3 |
from pathlib import Path
|
|
|
|
| 4 |
|
| 5 |
root = Path(__file__).resolve().parent
|
| 6 |
sys.path.insert(0, str(root))
|
| 7 |
os.chdir(str(root))
|
| 8 |
|
|
|
|
|
|
|
| 9 |
try:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
except Exception as e:
|
| 15 |
-
st.error(f"
|
| 16 |
st.code(traceback.format_exc())
|
|
|
|
| 1 |
import sys, os, traceback
|
| 2 |
import streamlit as st
|
| 3 |
from pathlib import Path
|
| 4 |
+
import importlib.util
|
| 5 |
|
| 6 |
root = Path(__file__).resolve().parent
|
| 7 |
sys.path.insert(0, str(root))
|
| 8 |
os.chdir(str(root))
|
| 9 |
|
| 10 |
+
demo_file = root / "demo" / "streamlit_app.py"
|
| 11 |
+
|
| 12 |
try:
|
| 13 |
+
spec = importlib.util.spec_from_file_location("spindleflow_demo", str(demo_file))
|
| 14 |
+
mod = importlib.util.module_from_spec(spec)
|
| 15 |
+
mod.__file__ = str(demo_file)
|
| 16 |
+
sys.modules["spindleflow_demo"] = mod
|
| 17 |
+
spec.loader.exec_module(mod)
|
| 18 |
+
mod.main()
|
| 19 |
except Exception as e:
|
| 20 |
+
st.error(f"SpindleFlow failed to load: {e}")
|
| 21 |
st.code(traceback.format_exc())
|