Spaces:
Running
Running
Fix Gradio 5 mount error by moving theme/css to Blocks.
Browse filesmount_gradio_app in Gradio 5 does not accept theme/css kwargs, causing startup failure on Space.
Made-with: Cursor
- server/gradio_ui.py +12 -11
server/gradio_ui.py
CHANGED
|
@@ -352,9 +352,21 @@ def build_blocks(static_dir: Path) -> Any:
|
|
| 352 |
)
|
| 353 |
return suite_md, suite_json, sid, f"Session: `{sid}`"
|
| 354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
with gr.Blocks(
|
| 356 |
title="SQL Debug Environment",
|
| 357 |
analytics_enabled=False,
|
|
|
|
|
|
|
| 358 |
) as demo:
|
| 359 |
gr.HTML(
|
| 360 |
"""
|
|
@@ -690,21 +702,10 @@ def mount_gradio(app: Any, static_dir: Path) -> Any:
|
|
| 690 |
"""Mount single-page Gradio at `/` (Space home) while API routes stay on the same app."""
|
| 691 |
import gradio as gr
|
| 692 |
|
| 693 |
-
font = gr.themes.GoogleFont("Plus Jakarta Sans")
|
| 694 |
-
mono = gr.themes.GoogleFont("JetBrains Mono")
|
| 695 |
-
theme = gr.themes.Soft(
|
| 696 |
-
primary_hue="indigo",
|
| 697 |
-
secondary_hue="slate",
|
| 698 |
-
neutral_hue="slate",
|
| 699 |
-
font=(font, "ui-sans-serif", "system-ui"),
|
| 700 |
-
font_mono=(mono, "ui-monospace", "monospace"),
|
| 701 |
-
)
|
| 702 |
blocks = build_blocks(static_dir)
|
| 703 |
return gr.mount_gradio_app(
|
| 704 |
app,
|
| 705 |
blocks,
|
| 706 |
path="/gradio",
|
| 707 |
-
theme=theme,
|
| 708 |
-
css=GRADIO_CSS,
|
| 709 |
allowed_paths=[str(static_dir.resolve())],
|
| 710 |
)
|
|
|
|
| 352 |
)
|
| 353 |
return suite_md, suite_json, sid, f"Session: `{sid}`"
|
| 354 |
|
| 355 |
+
font = gr.themes.GoogleFont("Plus Jakarta Sans")
|
| 356 |
+
mono = gr.themes.GoogleFont("JetBrains Mono")
|
| 357 |
+
theme = gr.themes.Soft(
|
| 358 |
+
primary_hue="indigo",
|
| 359 |
+
secondary_hue="slate",
|
| 360 |
+
neutral_hue="slate",
|
| 361 |
+
font=(font, "ui-sans-serif", "system-ui"),
|
| 362 |
+
font_mono=(mono, "ui-monospace", "monospace"),
|
| 363 |
+
)
|
| 364 |
+
|
| 365 |
with gr.Blocks(
|
| 366 |
title="SQL Debug Environment",
|
| 367 |
analytics_enabled=False,
|
| 368 |
+
theme=theme,
|
| 369 |
+
css=GRADIO_CSS,
|
| 370 |
) as demo:
|
| 371 |
gr.HTML(
|
| 372 |
"""
|
|
|
|
| 702 |
"""Mount single-page Gradio at `/` (Space home) while API routes stay on the same app."""
|
| 703 |
import gradio as gr
|
| 704 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 705 |
blocks = build_blocks(static_dir)
|
| 706 |
return gr.mount_gradio_app(
|
| 707 |
app,
|
| 708 |
blocks,
|
| 709 |
path="/gradio",
|
|
|
|
|
|
|
| 710 |
allowed_paths=[str(static_dir.resolve())],
|
| 711 |
)
|