Deployment Ready: Fixed scam detection low confidence, added production audit report, optimized throttles
1838600 | import asyncio | |
| import httpx | |
| import json | |
| import sys | |
| # LIVE TARGET | |
| TARGET_URL = "https://avinashanalytics-sentinel-scam-honeypo.hf.space/api/guvi/analyze" | |
| async def validate_live_deployment(): | |
| print(f"π STARTING LIVE VALIDATION: {TARGET_URL}") | |
| print("ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ") | |
| payload = { | |
| "sessionId": "LIVE-AUDIT-001", | |
| "message": { | |
| "text": "Your bank account is locked. Click here to verify: http://bit.ly/scam", | |
| "sender": "scammer" | |
| }, | |
| "metadata": {"source": "validator_script"} | |
| } | |
| headers = { | |
| "x-api-key": "GUVI_HACKATHON_V2", # Updated based on user input | |
| "Content-Type": "application/json" | |
| } | |
| try: | |
| async with httpx.AsyncClient(timeout=15.0) as client: | |
| start_time = asyncio.get_event_loop().time() | |
| resp = await client.post(TARGET_URL, json=payload, headers=headers) | |
| end_time = asyncio.get_event_loop().time() | |
| latency = (end_time - start_time) * 1000 | |
| print(f"π‘ Status Code: {resp.status_code}") | |
| print(f"β±οΈ Latency: {latency:.2f}ms") | |
| if resp.status_code == 200: | |
| data = resp.json() | |
| print(f"β Response Body: {json.dumps(data, indent=2)}") | |
| # Compliance Checks | |
| failures = [] | |
| if "scamDetected" not in data: failures.append("Missing 'scamDetected'") | |
| if "extractedIntelligence" not in data: failures.append("Missing 'extractedIntelligence'") | |
| if "engagementMetrics" not in data: failures.append("Missing 'engagementMetrics'") | |
| # Check CamelCase | |
| if "riskLevel" not in data and "risk_level" in data: | |
| failures.append("Schema Violation: snake_case found instead of camelCase") | |
| if not failures: | |
| print(f"\nπ LIVE DEPLOYMENT IS COMPLIANT! (GUVI_HACKATHON_V2)") | |
| print("Status: READY FOR JUDGES") | |
| else: | |
| print(f"\nβ COMPLIANCE FAILURES: {failures}") | |
| else: | |
| print(f"β API Request Failed: {resp.text}") | |
| except Exception as e: | |
| print(f"β οΈ Network/System Error: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(validate_live_deployment()) | |