Aswini-Kumar commited on
Commit
bd953eb
·
verified ·
1 Parent(s): 09b7578

Upload test_live.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. test_live.py +33 -0
test_live.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ BASE = "https://aswini-kumar-datacentric-env.hf.space"
5
+
6
+ print("=== Testing live HuggingFace Space ===")
7
+
8
+ # Health check
9
+ h = requests.get(f"{BASE}/health", timeout=30)
10
+ print(f"Health: {h.status_code} -> {h.json()}")
11
+
12
+ # Reset
13
+ obs = requests.post(f"{BASE}/reset", json={}, timeout=60)
14
+ print(f"Reset: {obs.status_code}")
15
+ data = obs.json()
16
+ print(json.dumps(data, indent=2))
17
+
18
+ # Step
19
+ result = requests.post(
20
+ f"{BASE}/step",
21
+ json={"agent": "cleaner", "target": "all", "strategy": "median_impute"},
22
+ timeout=60,
23
+ )
24
+ print(f"Step status: {result.status_code}")
25
+ r = result.json()
26
+ reward = r["reward"]
27
+ done = r["done"]
28
+ acc = r["info"]["new_accuracy"]
29
+ print(f"reward={reward} done={done} accuracy={acc}")
30
+
31
+ assert 0.0 < reward < 1.0, f"Reward {reward} out of range!"
32
+ assert isinstance(done, bool), "done must be bool"
33
+ print("\nLIVE endpoint: ALL CHECKS PASSED")