Download ui/server.py from build-small-hackathon/project-halide: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/build-small-hackathon/project-halide/resolve/refs%2Fpr%2F2/ui/server.py
- Command line
-
hf download hf://spaces/build-small-hackathon/project-halide@refs/pr/2/ui/server.py
-
curl -L -o server.py https://huggingface.co/spaces/build-small-hackathon/project-halide/resolve/refs%2Fpr%2F2/ui/server.py
1.11 kB
| """Gradio Server wrapper for Project Halide.""" | |
| from __future__ import annotations | |
| import gradio as gr | |
| from config import CANONICAL_VISION_MODEL_ID, DEFAULT_REASONING_MODEL_ID | |
| from ui.app import build_app | |
| from ui.theme import THEME_CSS, build_theme | |
| def build_server(blocks: gr.Blocks | None = None) -> gr.Server: | |
| """Build a gr.Server with the UI mounted at root and health metadata.""" | |
| server = gr.Server( | |
| title="Project Halide", | |
| version="0.1.0", | |
| description="Edge-native analog film diagnostic engine.", | |
| ) | |
| def healthz() -> dict[str, str]: | |
| return { | |
| "status": "ok", | |
| "vision_model": CANONICAL_VISION_MODEL_ID, | |
| "reasoning_model": DEFAULT_REASONING_MODEL_ID, | |
| } | |
| gr.mount_gradio_app( | |
| server, | |
| blocks or build_app(), | |
| path="/", | |
| theme=build_theme(), | |
| css=THEME_CSS, | |
| show_error=True, | |
| allowed_paths=["assets"], | |
| favicon_path="assets/logo.jpg", | |
| max_file_size="60mb", | |
| ) | |
| return server | |
| __all__ = ["build_server"] | |