kylebrodeur commited on
Commit
4e669ff
·
verified ·
1 Parent(s): 2a4eaa7

fix: detect Space via SPACES_ZERO_GPU/SPACE_ID, skip self-launch on Space

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -478,7 +478,10 @@ except Exception as e:
478
  if __name__ == "__main__":
479
  try:
480
  print(f"[chief-engineer] {llm.backend_status()} | seeded {_loaded} lessons this run")
481
- demo.launch(ssr_mode=False)
 
 
 
482
  except Exception as e:
483
  import traceback
484
  print(f"[chief-engineer] LAUNCH ERROR: {e}")
 
478
  if __name__ == "__main__":
479
  try:
480
  print(f"[chief-engineer] {llm.backend_status()} | seeded {_loaded} lessons this run")
481
+ # On HF Spaces, pySpaces handles launch — detect via SPACES_ZERO_GPU
482
+ # (set on all GPU Spaces) or SPACE_ID (set on all Spaces).
483
+ if not os.environ.get("SPACES_ZERO_GPU") and not os.environ.get("SPACE_ID"):
484
+ demo.launch(ssr_mode=False)
485
  except Exception as e:
486
  import traceback
487
  print(f"[chief-engineer] LAUNCH ERROR: {e}")