Download src/controlnet_image_generator/inference/config_loader.py from danhtran2mind/ControlNet-Image-Generator: direct link, hf CLI and curl.
- Browser
- Download file 458 Bytes
-
https://huggingface.co/spaces/danhtran2mind/ControlNet-Image-Generator/resolve/main/src/controlnet_image_generator/inference/config_loader.py
- Command line
-
hf download hf://spaces/danhtran2mind/ControlNet-Image-Generator/src/controlnet_image_generator/inference/config_loader.py
-
curl -L -o config_loader.py https://huggingface.co/spaces/danhtran2mind/ControlNet-Image-Generator/resolve/main/src/controlnet_image_generator/inference/config_loader.py
458 Bytes
| import yaml | |
| def load_config(config_path): | |
| try: | |
| with open(config_path, 'r') as file: | |
| return yaml.safe_load(file) | |
| except Exception as e: | |
| raise ValueError(f"Error loading config file: {e}") | |
| def find_config_by_model_id(configs, model_id): | |
| for config in configs: | |
| if config['model_id'] == model_id: | |
| return config | |
| raise ValueError(f"No configuration found for model_id: {model_id}") |