fairvalue-api / scratch /eval_top_5.py
FairValue
feat: implement professional PDF negotiation reports and terminology refinement
7dff677
import requests
import json
import time
players = [
{"selected_name": "Erling Haaland", "current_club": "Manchester City", "contract_years": 3, "age": 23, "injuries_24m": 20, "asking_price": 180, "market_value_estimation": 180},
{"selected_name": "Bukayo Saka", "current_club": "Arsenal", "contract_years": 3, "age": 22, "injuries_24m": 10, "asking_price": 130, "market_value_estimation": 130},
{"selected_name": "William Saliba", "current_club": "Arsenal", "contract_years": 4, "age": 23, "injuries_24m": 5, "asking_price": 80, "market_value_estimation": 80},
{"selected_name": "Ollie Watkins", "current_club": "Aston Villa", "contract_years": 4, "age": 28, "injuries_24m": 15, "asking_price": 65, "market_value_estimation": 65},
{"selected_name": "Martin Odegaard", "current_club": "Arsenal", "contract_years": 4, "age": 25, "injuries_24m": 25, "asking_price": 95, "market_value_estimation": 95}
]
url = "https://britzzy-fairvalue-api.hf.space/api/evaluate"
print("Evaluating 5 Premiership Players...\n")
for p in players:
try:
print(f"Requesting evaluation for {p['selected_name']}...")
response = requests.post(url, json=p, timeout=30)
if response.status_code == 200:
res = response.json()
L = res["ledger"]
nlp = res["nlp_results"]
print(f"--- {p['selected_name']} ({p['current_club']}) ---")
print(f"Age: {p['age']} | Contract: {p['contract_years']}yr | Market Value: £{p['market_value_estimation']}m")
print(f"ML Baseline Value: £{L['baseline_value']:.1f}m")
print(f"Intrinsic Talent: £{L['intrinsic_performance_value']:.1f}m")
print(f"Depreciation Penalty: £{L['depreciation']:.1f}m")
print(f"Hard Cap limit: £{L['hard_cap']:.1f}m")
print(f"NLP Sentiments - Durability: {nlp['durability']:.2f}, Form: {nlp['recency']:.2f}, Agent: {nlp['agent']:.2f}")
print("-------------------------------------------------\n")
else:
print(f"Failed for {p['selected_name']}: HTTP {response.status_code} - {response.text}")
except Exception as e:
print(f"Error fetching {p['selected_name']}: {str(e)}")
time.sleep(2)