Spaces:
Paused
Paused
Download hf_workspace/backend/experimental/settings.py from modventures/iris: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/modventures/iris/resolve/main/hf_workspace/backend/experimental/settings.py
- Command line
-
hf download hf://spaces/modventures/iris/hf_workspace/backend/experimental/settings.py
-
curl -L -o settings.py https://huggingface.co/spaces/modventures/iris/resolve/main/hf_workspace/backend/experimental/settings.py
1.29 kB
| """Validated server-side switches for controlled learned-engine experiments.""" | |
| from dataclasses import dataclass | |
| import os | |
| class LearnedSettings: | |
| matcher: str = 'loftr' | |
| max_size: int = 800 | |
| patches: str = 'single' | |
| adaptive_mask: bool = False | |
| def from_env(cls): | |
| matcher = os.environ.get('IRIS_MATCHER', 'loftr') | |
| patches = os.environ.get('IRIS_PATCH_VALIDATION', 'single') | |
| adaptive = os.environ.get('IRIS_ADAPTIVE_MASK', 'false').lower() | |
| try: | |
| size = int(os.environ.get('IRIS_MATCH_MAX_SIZE', '800' if matcher=='loftr' else '1600')) | |
| except ValueError as exc: | |
| raise RuntimeError('IRIS_MATCH_MAX_SIZE must be an integer.') from exc | |
| if matcher not in {'loftr', 'lightglue'} or patches not in {'single', 'multiscale', 'geometry'}: | |
| raise RuntimeError('Invalid learned matcher or patch-validation configuration.') | |
| if adaptive not in {'true', 'false'}: | |
| raise RuntimeError('IRIS_ADAPTIVE_MASK must be true or false.') | |
| if not 400 <= size <= (1200 if matcher=='loftr' else 2200): | |
| raise RuntimeError('IRIS_MATCH_MAX_SIZE exceeds the supported range.') | |
| return cls(matcher, size, patches, adaptive=='true') | |