|
|
"""Entry point for Hugging Face Spaces deployment. |
|
|
|
|
|
This module provides the entry point for deploying the stroke-deepisles-demo |
|
|
application to Hugging Face Spaces. It handles environment detection and |
|
|
configures Gradio appropriately for the deployment environment. |
|
|
|
|
|
See: |
|
|
- docs/specs/07-hf-spaces-deployment.md |
|
|
- https://huggingface.co/docs/hub/spaces-sdks-docker |
|
|
""" |
|
|
|
|
|
from pathlib import Path |
|
|
|
|
|
import gradio as gr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_ASSETS_DIR = Path(__file__).parent / "src" / "stroke_deepisles_demo" / "ui" / "assets" |
|
|
gr.set_static_paths(paths=[str(_ASSETS_DIR)]) |
|
|
|
|
|
from stroke_deepisles_demo.core.config import get_settings |
|
|
from stroke_deepisles_demo.core.logging import setup_logging |
|
|
from stroke_deepisles_demo.ui.app import get_demo |
|
|
from stroke_deepisles_demo.ui.viewer import get_niivue_loader_path |
|
|
|
|
|
|
|
|
settings = get_settings() |
|
|
setup_logging(settings.log_level, format_style=settings.log_format) |
|
|
|
|
|
|
|
|
demo = get_demo() |
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
niivue_loader = get_niivue_loader_path() |
|
|
|
|
|
demo.launch( |
|
|
server_name=settings.gradio_server_name, |
|
|
server_port=settings.gradio_server_port, |
|
|
share=settings.gradio_share, |
|
|
theme=gr.themes.Soft(), |
|
|
css="footer {visibility: hidden}", |
|
|
allowed_paths=[str(_ASSETS_DIR)], |
|
|
head_paths=[str(niivue_loader)], |
|
|
) |
|
|
|