Spaces:
Sleeping
Sleeping
Download api_endpoints.py from LordXido/CodexFlow_TM: direct link, hf CLI and curl.
- Browser
- Download file 634 Bytes
-
https://huggingface.co/spaces/LordXido/CodexFlow_TM/resolve/main/api_endpoints.py
- Command line
-
hf download hf://spaces/LordXido/CodexFlow_TM/api_endpoints.py
-
curl -L -o api_endpoints.py https://huggingface.co/spaces/LordXido/CodexFlow_TM/resolve/main/api_endpoints.py
634 Bytes
| # api_endpoints.py | |
| from economic_service import harmonize | |
| from proof_engine import make_proof | |
| def run_harmonization(request: dict) -> dict: | |
| """ | |
| Accepts request like: | |
| { | |
| "commodity": "Gold", | |
| "physical_anchor": 950, | |
| "reporting_lag": 7 | |
| } | |
| Returns result + proof. | |
| """ | |
| commodity = request.get("commodity") | |
| anchor = float(request.get("physical_anchor", 0)) | |
| lag = int(request.get("reporting_lag", 0)) | |
| result = harmonize(commodity, anchor, lag) | |
| proof = make_proof(request, result) | |
| return { | |
| "status": "ok", | |
| "result": result, | |
| "proof": proof | |
| } |