Spaces:
Running
Running
Dan Flower
deploy: sync model/utils into TemplateA and update Dockerfile (canonical COPY + cache-bust)
8667228
| import os | |
| from typing import Optional, Dict | |
| # Optional: load .env for local dev; harmless on HF Spaces | |
| try: | |
| from dotenv import load_dotenv # type: ignore | |
| load_dotenv() | |
| except Exception: | |
| pass | |
| def _as_bool(val: Optional[str], default: bool) -> bool: | |
| if val is None: | |
| return default | |
| return val.strip().lower() in {"1", "true", "yes", "on", "y", "t"} | |
| # Defaults preserve current behaviour (all off unless env enabled) | |
| SANITIZE_ENABLED = _as_bool(os.getenv("LAB_SANITIZE_ENABLED"), False) | |
| STOPSEQ_ENABLED = _as_bool(os.getenv("LAB_STOPSEQ_ENABLED"), False) | |
| CRITIC_ENABLED = _as_bool(os.getenv("LAB_CRITIC_ENABLED"), False) | |
| JSON_MODE = _as_bool(os.getenv("LAB_JSON_MODE"), False) | |
| EVIDENCE_GATE = _as_bool(os.getenv("LAB_EVIDENCE_GATE"), False) | |
| def snapshot() -> Dict[str, bool]: | |
| return { | |
| "LAB_SANITIZE_ENABLED": SANITIZE_ENABLED, | |
| "LAB_STOPSEQ_ENABLED": STOPSEQ_ENABLED, | |
| "LAB_CRITIC_ENABLED": CRITIC_ENABLED, | |
| "LAB_JSON_MODE": JSON_MODE, | |
| "LAB_EVIDENCE_GATE": EVIDENCE_GATE, | |
| } | |