Spaces:
Sleeping
Sleeping
Download src/utils/storage.py from rahulmolasi/SmartDayAI: direct link, hf CLI and curl.
- Browser
- Download file 416 Bytes
-
https://huggingface.co/spaces/rahulmolasi/SmartDayAI/resolve/main/src/utils/storage.py
- Command line
-
hf download hf://spaces/rahulmolasi/SmartDayAI/src/utils/storage.py
-
curl -L -o storage.py https://huggingface.co/spaces/rahulmolasi/SmartDayAI/resolve/main/src/utils/storage.py
416 Bytes
| import json, os | |
| def load_json(file_path): | |
| if os.path.exists(file_path): | |
| with open(file_path, "r") as f: | |
| try: | |
| return json.load(f) | |
| except json.JSONDecodeError: | |
| return [] | |
| return [] | |
| def save_json(file_path, data): | |
| os.makedirs(os.path.dirname(file_path), exist_ok=True) | |
| with open(file_path, "w") as f: | |
| json.dump(data, f, indent=4) | |