Download utils.py from gshbao/glimpse: direct link, hf CLI and curl.
- Browser
- Download file 625 Bytes
-
https://huggingface.co/spaces/gshbao/glimpse/resolve/main/utils.py
- Command line
-
hf download hf://spaces/gshbao/glimpse/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/gshbao/glimpse/resolve/main/utils.py
625 Bytes
| # Copyright (c) Guangsheng Bao. | |
| # | |
| # This source code is licensed under the MIT license found in the | |
| # LICENSE file in the root directory of this source tree. | |
| import json | |
| from io import open | |
| def load_json(filename): | |
| with open(filename, encoding='utf-8') as f: | |
| return json.load(f) | |
| def save_json(filename, data): | |
| with open(filename, 'w', encoding='utf-8') as f: | |
| json.dump(data, f, indent=2, ensure_ascii=False) | |
| def load_text(filename): | |
| with open(filename) as f: | |
| return f.read() | |
| def save_text(filename, text): | |
| with open(filename, 'w') as f: | |
| f.write(text) | |