Download utils.py from Mungert/GradLLM: direct link, hf CLI and curl.
- Browser
- Download file 381 Bytes
-
https://huggingface.co/spaces/Mungert/GradLLM/resolve/main/utils.py
- Command line
-
hf download hf://spaces/Mungert/GradLLM/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/Mungert/GradLLM/resolve/main/utils.py
381 Bytes
| import json, zlib, base64 | |
| from typing import Any | |
| def to_json(obj: Any) -> str: | |
| return json.dumps(obj, ensure_ascii=False, separators=(",", ":")) | |
| def json_compress_str(s: str) -> str: | |
| return base64.b64encode(zlib.compress(s.encode("utf-8"), level=6)).decode("ascii") | |
| def json_decompress_str(s: str) -> str: | |
| return zlib.decompress(base64.b64decode(s)).decode("utf-8") | |