Download skp/configs/__init__.py from ianpan/bone-age-greulich-and-pyle: direct link, hf CLI and curl.
- Browser
- Download file 651 Bytes
-
https://huggingface.co/spaces/ianpan/bone-age-greulich-and-pyle/resolve/455e8ef9eb7497e8358e855a8360135b7f7184b6/skp/configs/__init__.py
- Command line
-
hf download hf://spaces/ianpan/bone-age-greulich-and-pyle@455e8ef9eb7497e8358e855a8360135b7f7184b6/skp/configs/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/ianpan/bone-age-greulich-and-pyle/resolve/455e8ef9eb7497e8358e855a8360135b7f7184b6/skp/configs/__init__.py
651 Bytes
| from types import SimpleNamespace | |
| class Config(SimpleNamespace): | |
| def __getattribute__(self, value): | |
| # If attribute not specified in config, | |
| # return None instead of raise error | |
| try: | |
| return super().__getattribute__(value) | |
| except AttributeError: | |
| return None | |
| def __str__(self): | |
| # pretty print | |
| string = ["config"] | |
| string.append("=" * len(string[0])) | |
| longest_param_name = max([len(k) for k in [*self.__dict__]]) | |
| for k, v in self.__dict__.items(): | |
| string.append(f"{k.ljust(longest_param_name)} : {v}") | |
| return "\n".join(string) | |