Spaces:
Running on Zero

openhands commited on
Commit
2e2e48c
·
1 Parent(s): 7060767

chore: drop startup diagnostics

Browse files
Files changed (1) hide show
  1. app.py +3 -34
app.py CHANGED
@@ -68,10 +68,6 @@ def gpu_marker() -> str:
68
 
69
  app = FastAPI(title="EXELYN Sandbox Engine", docs_url=None, redoc_url=None)
70
 
71
-
72
- @app.get("/__probe")
73
- async def __probe() -> dict[str, str]:
74
- return {"probe": "ok"}
75
  STARTED_AT = time.time()
76
 
77
 
@@ -643,17 +639,6 @@ demo = build_ui()
643
  app = gr.mount_gradio_app(app, demo, path="/")
644
 
645
 
646
- def _diagnose() -> None:
647
- """Temporary startup diagnostics for the hosting environment."""
648
- print("[diag] env:", {k: v for k, v in os.environ.items() if "PORT" in k or "SPACE" in k or "GRADIO" in k})
649
- for command in (["ss", "-ltnp"], ["curl", "-s", "-o", "/dev/null", "-w", "%{http_code}", "http://127.0.0.1:7860/"]):
650
- try:
651
- done = subprocess.run(command, capture_output=True, text=True, timeout=10)
652
- print("[diag]", command[0], "->", (done.stdout or done.stderr)[:2000])
653
- except Exception as error: # noqa: BLE001
654
- print("[diag]", command[0], "failed:", error)
655
-
656
-
657
  def _prepend_sandbox_routes(target: FastAPI) -> None:
658
  """Puts /api/* and /preview/* ahead of Gradio's catch-all mount."""
659
  ours = [
@@ -686,23 +671,7 @@ def _patch_gradio_app() -> None:
686
 
687
 
688
  if __name__ == "__main__":
689
- _diagnose()
690
  _patch_gradio_app()
691
- # demo.launch() runs the ZeroGPU handshake and lets Gradio pick the first
692
- # free port behind the Space supervisor, then serves the patched app.
693
- demo.launch(
694
- server_name="0.0.0.0", quiet=False, ssr_mode=False, prevent_thread_lock=True
695
- )
696
- served = getattr(demo, "server_app", None)
697
- print(
698
- "[routes] served first:",
699
- [str(getattr(route, "path", "")) for route in getattr(getattr(served, "router", None), "routes", [])[:6]],
700
- "| has api:",
701
- any(str(getattr(route, "path", "")).startswith("/api/") for route in getattr(getattr(served, "router", None), "routes", [])),
702
- flush=True,
703
- )
704
- try:
705
- while True:
706
- time.sleep(3600)
707
- except KeyboardInterrupt: # pragma: no cover
708
- pass
 
68
 
69
  app = FastAPI(title="EXELYN Sandbox Engine", docs_url=None, redoc_url=None)
70
 
 
 
 
 
71
  STARTED_AT = time.time()
72
 
73
 
 
639
  app = gr.mount_gradio_app(app, demo, path="/")
640
 
641
 
 
 
 
 
 
 
 
 
 
 
 
642
  def _prepend_sandbox_routes(target: FastAPI) -> None:
643
  """Puts /api/* and /preview/* ahead of Gradio's catch-all mount."""
644
  ours = [
 
671
 
672
 
673
  if __name__ == "__main__":
 
674
  _patch_gradio_app()
675
+ # demo.launch() runs the ZeroGPU handshake, lets Gradio pick the first free
676
+ # port behind the Space supervisor, and serves the patched app.
677
+ demo.launch(server_name="0.0.0.0", quiet=False, ssr_mode=False)