Spaces:
Paused
Paused
Download src/controlnet_aux/zoe/zoedepth/utils/arg_utils.py from acmyu/KeyframesAI: direct link, hf CLI and curl.
- Browser
- Download file 624 Bytes
-
https://huggingface.co/spaces/acmyu/KeyframesAI/resolve/main/src/controlnet_aux/zoe/zoedepth/utils/arg_utils.py
- Command line
-
hf download hf://spaces/acmyu/KeyframesAI/src/controlnet_aux/zoe/zoedepth/utils/arg_utils.py
-
curl -L -o arg_utils.py https://huggingface.co/spaces/acmyu/KeyframesAI/resolve/main/src/controlnet_aux/zoe/zoedepth/utils/arg_utils.py
624 Bytes
| def infer_type(x): # hacky way to infer type from string args | |
| if not isinstance(x, str): | |
| return x | |
| try: | |
| x = int(x) | |
| return x | |
| except ValueError: | |
| pass | |
| try: | |
| x = float(x) | |
| return x | |
| except ValueError: | |
| pass | |
| return x | |
| def parse_unknown(unknown_args): | |
| clean = [] | |
| for a in unknown_args: | |
| if "=" in a: | |
| k, v = a.split("=") | |
| clean.extend([k, v]) | |
| else: | |
| clean.append(a) | |
| keys = clean[::2] | |
| values = clean[1::2] | |
| return {k.replace("--", ""): infer_type(v) for k, v in zip(keys, values)} | |