billyaungmyint commited on
Commit
a8a8068
·
verified ·
1 Parent(s): 7b2d959

Sync from GitHub via hub-sync

Browse files
Files changed (2) hide show
  1. VERSION +1 -1
  2. main.py +3 -12
VERSION CHANGED
@@ -1 +1 @@
1
- cc68171513c91148b7ac59a8fd45a07f5d01798d
 
1
+ 47e58f33bfd7b92740359aa226ca40a0e7e482c6
main.py CHANGED
@@ -26,7 +26,9 @@ def _build_label() -> str:
26
 
27
 
28
  # Initialize HF Inference Client with Z.ai provider (via HF_TOKEN)
29
- client = InferenceClient()
 
 
30
  MODEL = "zai-org/GLM-5.1"
31
 
32
 
@@ -85,15 +87,4 @@ if __name__ == "__main__":
85
  # root_path ensures Gradio resolves JS/CSS assets correctly when running
86
  # behind a reverse proxy or custom domain.
87
  _root_path = os.getenv("GRADIO_ROOT_PATH", "").rstrip("/")
88
- demo.launch(server_name="0.0.0.0", root_path=_root_path)
89
-
90
-
91
- if __name__ == "__main__":
92
- # server_name="0.0.0.0" is required inside HF Space containers.
93
- # root_path ensures Gradio resolves JS/CSS assets correctly when running
94
- # behind a reverse proxy or custom domain.
95
- # Strip any trailing slash from GRADIO_ROOT_PATH; an incorrect value (e.g.
96
- # the old .hf.space URL) after a custom-domain DNS change causes Gradio's
97
- # frontend to fetch /info from the wrong origin → "Could not get API info".
98
- _root_path = os.getenv("GRADIO_ROOT_PATH", "").rstrip("/")
99
  demo.launch(server_name="0.0.0.0", root_path=_root_path)
 
26
 
27
 
28
  # Initialize HF Inference Client with Z.ai provider (via HF_TOKEN)
29
+ # Explicitly pass token for HF Space compatibility
30
+ hf_token = os.getenv("HF_TOKEN")
31
+ client = InferenceClient(token=hf_token) if hf_token else InferenceClient()
32
  MODEL = "zai-org/GLM-5.1"
33
 
34
 
 
87
  # root_path ensures Gradio resolves JS/CSS assets correctly when running
88
  # behind a reverse proxy or custom domain.
89
  _root_path = os.getenv("GRADIO_ROOT_PATH", "").rstrip("/")
 
 
 
 
 
 
 
 
 
 
 
90
  demo.launch(server_name="0.0.0.0", root_path=_root_path)