AndrewRqy commited on
Commit ·
5053a2a
1
Parent(s): 63f7ef4
Remove unsupported @import + register assets via set_static_paths
Browse files943 unmodified lines9449459469479489499504067 unmodified lines501850195020502150225023943 unmodified linesCSS = """@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');:root {--w-night: #18141f; /* page background */4067 unmodified lines# one base64-encodes ~30 sprites), we skip the eager build when the flag is# present.if "--self-test" in sys.argv:demo = Noneelif os.environ.get("BISECT_MINIMAL") == "1":943 unmodified lines9449459469479489499509519529534067 unmodified lines502150225023502450255026502750285029503050315032503350345035503650375038943 unmodified linesCSS = """/* Fonts are loaded via the theme's GoogleFont() declarations (Press Start 2P+ VT323), not via @import. Gradio injects user CSS as a constructedstylesheet which doesn't allow @import — leaving the @import in herespams the browser console with "@import rules are not allowed here". */:root {--w-night: #18141f; /* page background */4067 unmodified lines# one base64-encodes ~30 sprites), we skip the eager build when the flag is# present.# Register the assets directory with Gradio's static file router so# /gradio_api/file=<absolute-path> URLs served at runtime resolve to actual# files. ``set_static_paths`` is more reliable than ``allowed_paths`` on# launch() because it takes effect at module load, before any request hits.try:gr.set_static_paths(paths=[_HERE / "assets"])except Exception:# Gradio versions without set_static_paths fall back to ``allowed_paths``# via demo.launch(...) — harmless to skip here.passif "--self-test" in sys.argv:demo = Noneelif os.environ.get("BISECT_MINIMAL") == "1":
app.py+16-1