import requests import json import time url = "http://localhost:5000/predict" # Scenario: 2v2 Clutch # T Team: Together (Planting B site?) # CT Team: Separated (Retaking?) payload_spatial = { "game_time": 90.0, "players": [ # T Team (Team 2) - Clumped together {"team_num": 2, "is_alive": True, "health": 100, "X": -1000, "Y": 2000, "Z": 0}, {"team_num": 2, "is_alive": True, "health": 100, "X": -1050, "Y": 2050, "Z": 0}, # CT Team (Team 3) - Far apart (Retaking from different angles) {"team_num": 3, "is_alive": True, "health": 100, "X": 0, "Y": 0, "Z": 0}, # Mid {"team_num": 3, "is_alive": True, "health": 100, "X": -2000, "Y": 3000, "Z": 0} # Flanking ] } def test_payload(name, payload): print(f"\n--- Testing {name} ---") try: response = requests.post(url, json=payload, timeout=2) print("Status Code:", response.status_code) if response.status_code == 200: data = response.json() print("Response Prediction:", data['prediction']) print("Win Probability:", json.dumps(data['win_probability'], indent=2)) print("Spatial Features Calculated:") feats = data['features_used'] print(f" Team Distance: {feats.get('team_distance', 'N/A'):.2f}") print(f" T Spread: {feats.get('t_spread', 'N/A'):.2f}") print(f" CT Spread: {feats.get('ct_spread', 'N/A'):.2f}") else: print("Error:", response.text) except Exception as e: print(f"Request failed: {e}") if __name__ == "__main__": test_payload("Spatial 2v2 Scenario", payload_spatial)