GitHub Actions commited on
Commit
c2fa541
·
1 Parent(s): bbf7292

fix(spaces): bind app to port 7860 and disable SSR to fix HF launch timeout

Browse files

- app_nemotron.py (HF app_file) defaulted to 7869 but HF health-checks 7860
- Prefer GRADIO_SERVER_PORT, then PORT, then 7860
- Disable Gradio SSR (Node proxy crashed, left :7860 unhealthy -> timeout)
- Apply same explicit 7860 + ssr_mode=False to app.py

Files changed (2) hide show
  1. app.py +11 -1
  2. app_nemotron.py +6 -1
app.py CHANGED
@@ -678,4 +678,14 @@ if _webagent_dir.exists():
678
  print(f"[hearthnet] create_app patch failed: {_pe}")
679
 
680
  if __name__ == "__main__":
681
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
678
  print(f"[hearthnet] create_app patch failed: {_pe}")
679
 
680
  if __name__ == "__main__":
681
+ import os
682
+
683
+ # HF Spaces health-checks port 7860. Bind explicitly and disable Gradio
684
+ # SSR mode (Node proxy on a different port crashes on HF and the health
685
+ # check on :7860 then times out -> "workload was not healthy").
686
+ _port = int(os.environ.get("GRADIO_SERVER_PORT", "7860"))
687
+ demo.launch(
688
+ server_name="0.0.0.0",
689
+ server_port=_port,
690
+ ssr_mode=False,
691
+ )
app_nemotron.py CHANGED
@@ -525,9 +525,14 @@ Document Input ──► Nemotron Parse ──► Structured JSON
525
 
526
  if __name__ == "__main__":
527
  demo = build_app()
 
 
 
 
528
  demo.launch(
529
  server_name="0.0.0.0", # nosec B104
530
- server_port=int(os.getenv("PORT", "7869")),
 
531
  theme=_theme,
532
  css="""
533
  .grad-banner { background: linear-gradient(135deg, #7c3aed 0%, #f97316 100%);
 
525
 
526
  if __name__ == "__main__":
527
  demo = build_app()
528
+ # HF Spaces health-checks port 7860. Prefer GRADIO_SERVER_PORT (set by HF),
529
+ # fall back to PORT, then 7860. Disable SSR: the Node proxy binds a different
530
+ # port and crashes on HF, leaving :7860 unhealthy -> launch timeout.
531
+ _port = int(os.getenv("GRADIO_SERVER_PORT") or os.getenv("PORT") or "7860")
532
  demo.launch(
533
  server_name="0.0.0.0", # nosec B104
534
+ server_port=_port,
535
+ ssr_mode=False,
536
  theme=_theme,
537
  css="""
538
  .grad-banner { background: linear-gradient(135deg, #7c3aed 0%, #f97316 100%);