UCS2014 commited on
Commit
f8836fa
·
verified ·
1 Parent(s): a47e354

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -144,7 +144,14 @@ def infer_features_from_model(m):
144
  # =========================
145
  # Model availability (download on cloud if needed)
146
  # =========================
147
- MODEL_URL = st.secrets.get("MODEL_URL", os.environ.get("MODEL_URL", "")).strip()
 
 
 
 
 
 
 
148
 
149
  def ensure_model_present() -> Path:
150
  # Check local paths first
 
144
  # =========================
145
  # Model availability (download on cloud if needed)
146
  # =========================
147
+ def _get_model_url():
148
+ # Works even if there is NO secrets.toml in the Space
149
+ try:
150
+ return (st.secrets.get("MODEL_URL", "") or os.environ.get("MODEL_URL", "") or "").strip()
151
+ except Exception:
152
+ return (os.environ.get("MODEL_URL", "") or "").strip()
153
+
154
+ MODEL_URL = _get_model_url()
155
 
156
  def ensure_model_present() -> Path:
157
  # Check local paths first