Spaces:
Sleeping
Sleeping
Fix float rounding output limit to prevent out of bounds exactly 1.0 rewards in logged inference metrics
36fffc4 Download test_live_endpoints.py from printf-sourav/CICD: direct link, hf CLI and curl.
- Browser
- Download file 961 Bytes
-
https://huggingface.co/spaces/printf-sourav/CICD/resolve/main/test_live_endpoints.py
- Command line
-
hf download hf://spaces/printf-sourav/CICD/test_live_endpoints.py
-
curl -L -o test_live_endpoints.py https://huggingface.co/spaces/printf-sourav/CICD/resolve/main/test_live_endpoints.py
961 Bytes
| import requests | |
| import json | |
| BASE_URL = "https://printf-sourav-cicd.hf.space" | |
| def print_res(name, res): | |
| print(f"\n--- Testing HTTP {name} ---") | |
| print(f"Status Code: {res.status_code}") | |
| try: | |
| print(json.dumps(res.json(), indent=2)[:300] + "...") | |
| except: | |
| print(res.text) | |
| print("Starting live endpoint verification...\n") | |
| # 1. Root Endpoint | |
| print_res("GET /", requests.get(f"{BASE_URL}/")) | |
| # 2. Health Endpoint | |
| print_res("GET /health", requests.get(f"{BASE_URL}/health")) | |
| # 3. Reset Endpoint (Initialize to a specific task) | |
| reset_res = requests.post(f"{BASE_URL}/reset", json={"task_id": "easy-command-typo"}) | |
| print_res("POST /reset", reset_res) | |
| # 4. State Endpoint (Checking internals after reset) | |
| print_res("GET /state", requests.get(f"{BASE_URL}/state")) | |
| # 5. Step Endpoint (Taking an action) | |
| step_payload = {"action": "read_logs"} | |
| print_res("POST /step (read_logs)", requests.post(f"{BASE_URL}/step", json=step_payload)) | |