Spaces:
Runtime error
Runtime error
Claude Opus 5 (1M context)
Name mask classes from the request, not the canonical label table
ca3f97e Download pipelines/base.py from nvidia/nv-generate: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/nvidia/nv-generate/resolve/main/pipelines/base.py
- Command line
-
hf download hf://spaces/nvidia/nv-generate/pipelines/base.py
-
curl -L -o base.py https://huggingface.co/spaces/nvidia/nv-generate/resolve/main/pipelines/base.py
1.3 kB
| from __future__ import annotations | |
| from dataclasses import dataclass, field | |
| from typing import Literal, Optional | |
| ModelKey = Literal["ct", "mr", "mr_brain"] | |
| class GenerationRequest: | |
| model: ModelKey | |
| output_size: tuple[int, int, int] | |
| spacing: tuple[float, float, float] | |
| seed: int = 0 | |
| num_steps: int = 30 | |
| cfg_guidance_scale: float = 0.0 | |
| # CT-only | |
| body_region: Optional[list[str]] = None | |
| anatomy_list: Optional[list[str]] = None | |
| generate_masks: bool = True | |
| # MR-only (modality int from configs/modality_mapping.json: 8/9/10/11/...) | |
| modality_class: Optional[int] = None | |
| # MR-Brain-only (mapped to a modality int) | |
| contrast: Optional[str] = None # "T1" / "T2" / "FLAIR" / "SWI" / "T1_skull_stripped" / ... | |
| class GenerationResult: | |
| volume_path: str | |
| mask_path: Optional[str] = None | |
| used_anatomy_labels: dict[int, str] = field(default_factory=dict) | |
| # The requested anatomies, in request order. The saved CT mask indexes into | |
| # this 1-based rather than using canonical label IDs, so naming its values | |
| # is impossible without it (see pipelines.ct.resolve_anatomy_labels). | |
| anatomy_list: Optional[list[str]] = None | |
| runtime_seconds: float = 0.0 | |
| seed: int = 0 | |
| modality: Optional[int] = None | |