Spaces:
Sleeping
Sleeping
Download src/methodologies/utils/config.py from thanhnv2323/humanize-text: direct link, hf CLI and curl.
- Browser
- Download file 641 Bytes
-
https://huggingface.co/spaces/thanhnv2323/humanize-text/resolve/main/src/methodologies/utils/config.py
- Command line
-
hf download hf://spaces/thanhnv2323/humanize-text/src/methodologies/utils/config.py
-
curl -L -o config.py https://huggingface.co/spaces/thanhnv2323/humanize-text/resolve/main/src/methodologies/utils/config.py
641 Bytes
| """Configuration utilities.""" | |
| import toml | |
| from src.standard.llm_client import resolve_llm_config | |
| __all__ = ["load_config", "resolve_llm_config"] | |
| def resolve_config_path(path: str) -> str: | |
| import os | |
| from pathlib import Path | |
| if os.path.exists(path): | |
| return path | |
| pkg_config = Path(__file__).resolve().parent.parent.parent.parent / "config" / "config.toml" | |
| if pkg_config.exists(): | |
| return str(pkg_config) | |
| return path | |
| def load_config(path: str = "config/config.toml") -> dict: | |
| resolved = resolve_config_path(path) | |
| with open(resolved, "r", encoding="utf-8") as f: | |
| return toml.load(f) | |