RiverRider commited on
Commit
7fb1379
·
verified ·
1 Parent(s): cec8e12

Fix Space launch: bind 0.0.0.0:7860

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -557,11 +557,9 @@ def build() -> gr.Blocks:
557
  if __name__ == "__main__":
558
  app = build()
559
  app.queue(default_concurrency_limit=1, max_size=20)
560
- if _ON_ZEROGPU or os.environ.get("SPACE_ID"):
561
- # On HF Spaces the platform supplies host/port.
562
- app.launch()
563
- else:
564
- app.launch(
565
- server_name="0.0.0.0",
566
- server_port=int(os.environ.get("PORT", "8080")),
567
- )
 
557
  if __name__ == "__main__":
558
  app = build()
559
  app.queue(default_concurrency_limit=1, max_size=20)
560
+ # On HF Spaces the server must bind 0.0.0.0:7860 (localhost is not reachable
561
+ # through the platform proxy).
562
+ app.launch(
563
+ server_name="0.0.0.0",
564
+ server_port=int(os.environ.get("PORT", "7860")),
565
+ )