Spaces:
Running
Running
File size: 547 Bytes
6c58cf4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | from pathlib import Path
import yaml
from typing import Dict, Any
def load_config(config_path: str = None) -> Dict[str, Any]:
if config_path is None:
base_dir = Path(__file__).parent.parent
config_path = base_dir / "config" / "config.yaml"
else:
config_path = Path(config_path)
if not config_path.exists():
raise FileNotFoundError(f"Config file not found: {config_path}")
with open(config_path, 'r', encoding='utf-8') as file:
config = yaml.safe_load(file)
return config |