Spaces:
Running on Zero
Running on Zero
Disable Gradio SSR on Spaces - the SSR frontend 404s under a custom launch
Browse files
app.py
CHANGED
|
@@ -452,7 +452,17 @@ def serve_via_gradio() -> None:
|
|
| 452 |
# leaves its initial server-rendered state. That looks exactly like "the
|
| 453 |
# dashboard shows nothing" -- demo.load never fires, so the sign-in token in
|
| 454 |
# the query string is never read.
|
| 455 |
-
launch_kwargs: dict = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
if port := os.environ.get("APP_PORT"):
|
| 457 |
# Self-hosting / local dev, where nothing sets GRADIO_SERVER_PORT.
|
| 458 |
launch_kwargs["server_name"] = "0.0.0.0"
|
|
|
|
| 452 |
# leaves its initial server-rendered state. That looks exactly like "the
|
| 453 |
# dashboard shows nothing" -- demo.load never fires, so the sign-in token in
|
| 454 |
# the query string is never read.
|
| 455 |
+
launch_kwargs: dict = {
|
| 456 |
+
"prevent_thread_lock": True,
|
| 457 |
+
"show_api": False,
|
| 458 |
+
# Spaces sets GRADIO_SSR_MODE=1, which switches the frontend to a
|
| 459 |
+
# Node-rendered SvelteKit build served from /_app/immutable/*. Launching
|
| 460 |
+
# ourselves never starts that SSR server, so every CSS/JS asset 404s,
|
| 461 |
+
# no JavaScript runs, and the page freezes on its server-rendered shell.
|
| 462 |
+
# Client-side rendering serves the assets straight out of the installed
|
| 463 |
+
# gradio package and needs no Node.
|
| 464 |
+
"ssr_mode": False,
|
| 465 |
+
}
|
| 466 |
if port := os.environ.get("APP_PORT"):
|
| 467 |
# Self-hosting / local dev, where nothing sets GRADIO_SERVER_PORT.
|
| 468 |
launch_kwargs["server_name"] = "0.0.0.0"
|