LucasLooTan commited on
Commit
6ce0243
·
1 Parent(s): a5ffd9e

fix: share=True + SPACE_ID env to skip gradio's localhost-check pre-flight

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -1
  2. app.py +6 -1
Dockerfile CHANGED
@@ -28,7 +28,10 @@ COPY --chown=user . /app
28
  ENV GRADIO_SERVER_NAME=0.0.0.0 \
29
  GRADIO_SERVER_PORT=7860 \
30
  GRADIO_ANALYTICS_ENABLED=False \
31
- SYSTEM=spaces
 
 
 
32
  EXPOSE 7860
33
 
34
  CMD ["python", "app.py"]
 
28
  ENV GRADIO_SERVER_NAME=0.0.0.0 \
29
  GRADIO_SERVER_PORT=7860 \
30
  GRADIO_ANALYTICS_ENABLED=False \
31
+ SYSTEM=spaces \
32
+ SPACE_ID=lablab-ai-amd-developer-hackathon/signbridge \
33
+ SPACE_AUTHOR_NAME=lablab-ai-amd-developer-hackathon \
34
+ SPACE_REPO_NAME=signbridge
35
  EXPOSE 7860
36
 
37
  CMD ["python", "app.py"]
app.py CHANGED
@@ -23,10 +23,15 @@ def main() -> None:
23
  # hatch.
24
  os.environ.setdefault("SYSTEM", "spaces")
25
  demo = build_demo()
 
 
 
 
 
26
  demo.queue().launch(
27
  server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
28
  server_port=int(os.getenv("GRADIO_SERVER_PORT", "7860")),
29
- share=False,
30
  show_error=True,
31
  )
32
 
 
23
  # hatch.
24
  os.environ.setdefault("SYSTEM", "spaces")
25
  demo = build_demo()
26
+ # Gradio 4.44.1's _check_localhost pre-flight tries to connect to
27
+ # 127.0.0.1:7860 from inside the container and fails on HF's Docker
28
+ # SDK seccomp. Setting share=True is the documented bypass that skips
29
+ # the check; the FRP tunnel it would normally create is suppressed
30
+ # because HF detects the Space environment and serves directly.
31
  demo.queue().launch(
32
  server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
33
  server_port=int(os.getenv("GRADIO_SERVER_PORT", "7860")),
34
+ share=True,
35
  show_error=True,
36
  )
37