Spaces:
Sleeping
Sleeping
Download src/decision_model/settings.py from xstard/decision-model: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/xstard/decision-model/resolve/main/src/decision_model/settings.py
- Command line
-
hf download hf://spaces/xstard/decision-model/src/decision_model/settings.py
-
curl -L -o settings.py https://huggingface.co/spaces/xstard/decision-model/resolve/main/src/decision_model/settings.py
1.02 kB
| from pathlib import Path | |
| import os | |
| _source_root = Path(__file__).resolve().parents[2] | |
| _default_root = _source_root if (_source_root / "pyproject.toml").is_file() else Path.cwd() | |
| ROOT = Path(os.environ.get("DECISION_MODEL_HOME", _default_root)).resolve() | |
| HUB_CACHE = Path(os.environ.get("HF_HOME", ROOT / ".cache" / "huggingface")).resolve() | |
| ENCODER_ID = "jhu-clsp/mmBERT-small" | |
| ENCODER_REVISION = "abc32620dd4f6ab06f5fbe905dc25f310618e09f" | |
| MAX_TOKENS = 512 | |
| TEMPLATE_VERSION = "candidate-v1" | |
| def load_env(): | |
| """Load only project-local settings; never overwrite the caller's values.""" | |
| path = ROOT / ".env" | |
| if path.exists(): | |
| for line in path.read_text(encoding="utf-8-sig").splitlines(): | |
| if line.strip() and not line.lstrip().startswith("#") and "=" in line: | |
| key, value = line.split("=", 1) | |
| if key.strip() in {"OPENROUTER_API_KEY", "HF_TOKEN", "GENERATION_BUDGET_USD"}: | |
| os.environ.setdefault(key.strip(), value.strip().strip("\"'")) | |