Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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)
|