Deploy Pablo v21_3 (jurisdiction auto-detect, report-only, de-jargon) MERGED with green-B theme + badge fix + vertical routes + Catalan
2461d8f verified Download space_app.py from railnexus/value: direct link, hf CLI and curl.
- Browser
- Download file 4.21 kB
-
https://huggingface.co/spaces/railnexus/value/resolve/main/space_app.py
- Command line
-
hf download hf://spaces/railnexus/value/space_app.py
-
curl -L -o space_app.py https://huggingface.co/spaces/railnexus/value/resolve/main/space_app.py
4.21 kB
| """Hugging Face Spaces entrypoint (Gradio SDK) — declared as ``app_file`` in README.md. | |
| Why this is not ``app.py``: ``app.py`` is the route-selective system-prompt | |
| builder of the skill (imported by ``tests/test_structure.py`` and | |
| ``tests/test_v16.py`` as ``import app``), so the web entrypoint uses a | |
| different file name and the README frontmatter points HF at it. | |
| Launch line (carried over verbatim from the Space that is live at | |
| value.railnexus.io, 2026-09-17): ``ssr_mode=False`` and the absolute | |
| ``root_path`` are what let the Cloudflare custom domain reach the app, and | |
| ``css=`` on ``launch()`` needs Gradio >= 6 (``sdk_version`` in README.md is | |
| pinned accordingly). ``SPACE_ROOT_PATH`` only exists so the same file can be | |
| run on a laptop (set it to an empty string); on the Space it is unset and the | |
| value is exactly the production one. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import gradio as gr | |
| from web.ui import build_demo | |
| PRODUCTION_ROOT_PATH = "https://value.railnexus.io" | |
| # Verde Institucional: green accent + warm stone neutral. Gradio 6 takes the | |
| # theme on launch(), not on the Blocks constructor. Serif headings and the | |
| # stone page-ground come from the CSS below. | |
| THEME = gr.themes.Soft( | |
| primary_hue=gr.themes.colors.emerald, | |
| secondary_hue=gr.themes.colors.green, | |
| neutral_hue=gr.themes.colors.stone, | |
| font=(gr.themes.GoogleFont("Inter"), "system-ui", "sans-serif"), | |
| ) | |
| # Branding CSS carried over from the previous production Space (v8): hides the | |
| # HF Space header/footer and applies the RailNexus look. Selectors that do not | |
| # exist in this UI are simply inert. | |
| CSS = """ | |
| @import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap'); | |
| /* Hide the HF Space chrome. The floating badge is #huggingface-space-header — | |
| an ID, not a class; the March attempt targeting the class never matched it. */ | |
| #huggingface-space-header, | |
| .huggingface-space-header, | |
| div[class*="space-header"], | |
| header.container, | |
| div[data-testid="space-header"] { | |
| display: none !important; | |
| } | |
| footer { display: none !important; } | |
| .gradio-container { max-width: 1040px !important; margin: 0 auto; background: #f4f6f1; } | |
| body, gradio-app { background: #f4f6f1 !important; } | |
| /* Verde Institucional — muted forest-green accent, quiet labels (close to mockup B) */ | |
| .gradio-container { | |
| --button-primary-background-fill: #2f6b43; | |
| --button-primary-background-fill-hover: #27563a; | |
| --button-primary-border-color: #2f6b43; | |
| --button-primary-border-color-hover: #27563a; | |
| --button-primary-text-color: #ffffff; | |
| --block-label-background-fill: #ffffff; | |
| --block-label-text-color: #5b6b5e; | |
| --block-title-text-color: #17321f; | |
| --checkbox-background-color-selected: #2f6b43; | |
| --checkbox-border-color-selected: #2f6b43; | |
| --slider-color: #2f6b43; | |
| } | |
| /* selected radio/checkbox option: soft green chip with dark ink, not a solid block */ | |
| .gradio-container label.selected { | |
| background: #e8f1e6 !important; | |
| color: #17321f !important; | |
| } | |
| /* quiet field labels (mockup B): drop the green chip, muted ink */ | |
| .gradio-container span[data-testid="block-info"] { | |
| background: transparent !important; | |
| color: #5b6b5e !important; | |
| font-weight: 600; | |
| padding-left: 0 !important; | |
| } | |
| /* "Tipus d'anàlisi": one route per row (full-width labels wrap in the flex row) */ | |
| #route-radio label { width: 100% !important; justify-content: flex-start; } | |
| /* Upload box: two lines, no "- or -" between them (Pablo, v21_3) */ | |
| #project-files .or { display: block !important; height: 0; overflow: hidden; visibility: hidden; margin: 0; } | |
| /* serif deep-green headings */ | |
| .gradio-container h1 { | |
| font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif !important; | |
| font-weight: 700 !important; color: #17321f !important; letter-spacing: -0.01em; | |
| } | |
| .gradio-container h2, | |
| .gradio-container h3 { | |
| font-family: 'Source Serif 4', Georgia, serif !important; color: #17321f !important; | |
| } | |
| """ | |
| demo = build_demo() | |
| demo.queue() | |
| if __name__ == "__main__": | |
| root_path = os.environ.get("SPACE_ROOT_PATH", PRODUCTION_ROOT_PATH) | |
| demo.launch(ssr_mode=False, root_path=root_path or None, css=CSS, theme=THEME) | |