jin2li commited on
Commit
e6da9a8
ยท
verified ยท
1 Parent(s): d34fca7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -4850,42 +4850,37 @@ with gr.Blocks() as demo:
4850
  )
4851
 
4852
  # ============================================================
4853
- # Hugging Face Spaces launch
4854
- # - Gradio 6 SSR is explicitly disabled by env + launch kwargs
4855
- # - launch kwargs are filtered by the installed Gradio version
4856
- # - Gradio 5.x / 6.x compatibility
4857
  # ============================================================
4858
 
 
 
 
4859
  try:
4860
  demo.queue()
4861
  except Exception:
4862
  pass
4863
 
4864
  _launch_kwargs = {
4865
- "auth": auth_fn,
4866
  "server_name": "0.0.0.0",
4867
  "server_port": 7860,
 
4868
  "share": False,
4869
- "allowed_paths": ALLOWED_PATHS,
4870
- "blocked_paths": BLOCKED_PATHS,
4871
- "show_api": False,
4872
- "app_kwargs": {"docs_url": None, "redoc_url": None, "openapi_url": None},
4873
  }
4874
 
 
4875
  try:
4876
  _launch_params = set(inspect.signature(demo.launch).parameters.keys())
4877
  except Exception:
4878
  _launch_params = set()
4879
 
4880
- # Gradio 6.x: supported, required to prevent SSR boot hang on Spaces.
4881
  if not _launch_params or "ssr_mode" in _launch_params:
4882
  _launch_kwargs["ssr_mode"] = False
4883
 
4884
- # Gradio 6.x moved css to launch(); older Gradio versions ignore this via filtering.
4885
- if "css" in _launch_params:
4886
  _launch_kwargs["css"] = custom_css
4887
 
4888
- # Some Gradio versions do not expose these parameters.
4889
  _launch_kwargs = {k: v for k, v in _launch_kwargs.items() if (not _launch_params or k in _launch_params)}
4890
 
4891
  demo.launch(**_launch_kwargs)
 
4850
  )
4851
 
4852
  # ============================================================
4853
+ # Hugging Face Spaces launch - simple stable mode
 
 
 
4854
  # ============================================================
4855
 
4856
+ # ์ค‘์š”:
4857
+ # Hugging Face Spaces์—์„œ๋Š” share=True๊ฐ€ ํ•„์š” ์—†๊ณ , ์ผ๋ถ€ Gradio 6 SSR/iframe ์กฐํ•ฉ์—์„œ
4858
+ # App ํ™”๋ฉด์ด ๋นˆ ํ™”๋ฉด์œผ๋กœ ๋ฉˆ์ถœ ์ˆ˜ ์žˆ์–ด launch ์˜ต์…˜์„ ์ตœ์†Œํ™”ํ•œ๋‹ค.
4859
  try:
4860
  demo.queue()
4861
  except Exception:
4862
  pass
4863
 
4864
  _launch_kwargs = {
 
4865
  "server_name": "0.0.0.0",
4866
  "server_port": 7860,
4867
+ "auth": auth_fn,
4868
  "share": False,
 
 
 
 
4869
  }
4870
 
4871
+ # ์„ค์น˜๋œ Gradio ๋ฒ„์ „์— ์žˆ๋Š” ์ธ์ž๋งŒ ์ „๋‹ฌํ•œ๋‹ค. Gradio 5.x์—์„œ๋Š” ssr_mode๊ฐ€ ์—†์„ ์ˆ˜ ์žˆ๋‹ค.
4872
  try:
4873
  _launch_params = set(inspect.signature(demo.launch).parameters.keys())
4874
  except Exception:
4875
  _launch_params = set()
4876
 
 
4877
  if not _launch_params or "ssr_mode" in _launch_params:
4878
  _launch_kwargs["ssr_mode"] = False
4879
 
4880
+ # Gradio 6.x๋Š” css๋ฅผ launch()์—์„œ ๋ฐ›๋Š”๋‹ค. Gradio 5.x๋Š” ์—†์œผ๋ฉด ์ž๋™ ์ œ์™ธ๋œ๋‹ค.
4881
+ if not _launch_params or "css" in _launch_params:
4882
  _launch_kwargs["css"] = custom_css
4883
 
 
4884
  _launch_kwargs = {k: v for k, v in _launch_kwargs.items() if (not _launch_params or k in _launch_params)}
4885
 
4886
  demo.launch(**_launch_kwargs)