NexusInstruments commited on
Commit
ce0124c
·
verified ·
1 Parent(s): 40742ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -73,10 +73,28 @@ with st.expander("🧩 Session Diagnostics", expanded=False):
73
  st.subheader("📊 Realtime System Dashboard (Taipy)")
74
 
75
  # Safe Hugging Face check
76
- if hasattr(st, "secrets") and "SPACE_ID" in getattr(st, "secrets", {}):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  st.info("Taipy dashboard is disabled on Hugging Face Spaces (requires local port).")
78
  else:
79
  try:
80
  st.components.v1.iframe(config["TAIPY_URL"], height=600)
81
- except Exception:
82
- st.warning("Unable to load Taipy dashboard.")
 
73
  st.subheader("📊 Realtime System Dashboard (Taipy)")
74
 
75
  # Safe Hugging Face check
76
+ import contextlib
77
+
78
+ st.subheader("📊 Realtime System Dashboard (Taipy)")
79
+
80
+ # Safe Hugging Face / local check
81
+ import contextlib
82
+
83
+ st.subheader("📊 Realtime System Dashboard (Taipy)")
84
+
85
+ # Safe Hugging Face / local check
86
+ with contextlib.suppress(Exception):
87
+ has_secrets = bool(getattr(st, "secrets", None))
88
+ space_id = None
89
+ if has_secrets:
90
+ # st.secrets might raise if no file is present, so use suppress again
91
+ with contextlib.suppress(Exception):
92
+ space_id = st.secrets.get("SPACE_ID")
93
+
94
+ if space_id:
95
  st.info("Taipy dashboard is disabled on Hugging Face Spaces (requires local port).")
96
  else:
97
  try:
98
  st.components.v1.iframe(config["TAIPY_URL"], height=600)
99
+ except Exception as e:
100
+ st.warning(f"Unable to load Taipy dashboard: {e}")