Spaces:
Build error
Build error
Download utils/j_utils.py from anastaszizi/DeepLearning_FollowAlong: direct link, hf CLI and curl.
- Browser
- Download file 469 Bytes
-
https://huggingface.co/spaces/anastaszizi/DeepLearning_FollowAlong/resolve/main/utils/j_utils.py
- Command line
-
hf download hf://spaces/anastaszizi/DeepLearning_FollowAlong/utils/j_utils.py
-
curl -L -o j_utils.py https://huggingface.co/spaces/anastaszizi/DeepLearning_FollowAlong/resolve/main/utils/j_utils.py
469 Bytes
| import os | |
| from dotenv import load_dotenv | |
| import json | |
| from pprint import pprint | |
| from pathlib import Path | |
| def load_env_vars(key): | |
| load_dotenv() | |
| if key: | |
| return os.getenv(key) | |
| return None | |
| def has_json_extension(filepath): | |
| return Path(filepath).suffix.lower() == '.json' | |
| def print_json(path): | |
| if os.path.exists(path) and has_json_extension(path): | |
| with open(path, 'r') as f: | |
| data = json.load(f) | |
| pprint(data) |