Spaces:
Runtime error
Runtime error
Download basicsr/archs/__init__.py from MadeWithAI/MWAI-Swap-Face-Model: direct link, hf CLI and curl.
- Browser
- Download file 884 Bytes
-
https://huggingface.co/spaces/MadeWithAI/MWAI-Swap-Face-Model/resolve/main/basicsr/archs/__init__.py
- Command line
-
hf download hf://spaces/MadeWithAI/MWAI-Swap-Face-Model/basicsr/archs/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/MadeWithAI/MWAI-Swap-Face-Model/resolve/main/basicsr/archs/__init__.py
884 Bytes
| import importlib | |
| from copy import deepcopy | |
| from os import path as osp | |
| from basicsr.utils import get_root_logger, scandir | |
| from basicsr.utils.registry import ARCH_REGISTRY | |
| __all__ = ['build_network'] | |
| # automatically scan and import arch modules for registry | |
| # scan all the files under the 'archs' folder and collect files ending with '_arch.py' | |
| arch_folder = osp.dirname(osp.abspath(__file__)) | |
| arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scandir(arch_folder) if v.endswith('_arch.py')] | |
| # import all the arch modules | |
| _arch_modules = [importlib.import_module(f'basicsr.archs.{file_name}') for file_name in arch_filenames] | |
| def build_network(opt): | |
| opt = deepcopy(opt) | |
| network_type = opt.pop('type') | |
| net = ARCH_REGISTRY.get(network_type)(**opt) | |
| logger = get_root_logger() | |
| logger.info(f'Network [{net.__class__.__name__}] is created.') | |
| return net | |