Spaces:
Build error
Build error
Download model/third_party/HMNet/Utils/Serialization.py from akhaliq/SummerTime: direct link, hf CLI and curl.
- Browser
- Download file 468 Bytes
-
https://huggingface.co/spaces/akhaliq/SummerTime/resolve/main/model/third_party/HMNet/Utils/Serialization.py
- Command line
-
hf download hf://spaces/akhaliq/SummerTime/model/third_party/HMNet/Utils/Serialization.py
-
curl -L -o Serialization.py https://huggingface.co/spaces/akhaliq/SummerTime/resolve/main/model/third_party/HMNet/Utils/Serialization.py
468 Bytes
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT license. | |
| import json | |
| import numpy as np | |
| class NumpyJSONEncoder(json.JSONEncoder): | |
| def default(self, obj): | |
| if isinstance(obj, np.integer): | |
| return int(obj) | |
| elif isinstance(obj, np.floating): | |
| return float(obj) | |
| elif isinstance(obj, np.ndarray): | |
| return obj.tolist() | |
| else: | |
| return super(NumpyJSONEncoder, self).default(obj) | |