Download app/utils.py from Adisri99/Space-Risk-Intelligence-API: direct link, hf CLI and curl.
- Browser
- Download file 335 Bytes
-
https://huggingface.co/spaces/Adisri99/Space-Risk-Intelligence-API/resolve/main/app/utils.py
- Command line
-
hf download hf://spaces/Adisri99/Space-Risk-Intelligence-API/app/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/Adisri99/Space-Risk-Intelligence-API/resolve/main/app/utils.py
335 Bytes
| import json, uuid | |
| def safe_float(v,d=0.0): | |
| try: return d if v in (None,"") else float(v) | |
| except Exception: return d | |
| def safe_int(v,d=0): | |
| try: return d if v in (None,"") else int(v) | |
| except Exception: return d | |
| def dumps(x): return json.dumps(x, default=str) | |
| def new_id(prefix): return f"{prefix}_{uuid.uuid4().hex[:16]}" | |