-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluate.py
More file actions
69 lines (55 loc) · 1.6 KB
/
evaluate.py
File metadata and controls
69 lines (55 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import requests
from dotenv import load_dotenv
load_dotenv()
EMAIL = os.getenv("EMAIL")
if not EMAIL:
print("❌ Please set EMAIL in your .env file.")
exit(1)
# List of job queries
job_queries = [
"Tax Lawyer",
"Junior Corporate Lawyer",
"Radiology",
"Doctors (MD)",
"Biology Expert",
"Anthropology",
"Mathematics PhD",
"Quantitative Finance",
"Bankers",
"Mechanical Engineers"
]
def normalize(query):
return query.lower().replace(" ", "_")
print(f"{'Query':30} | {'# Candidates':12} | {'Avg Final Score'}")
print("-" * 60)
for query in job_queries:
filename = f"results/{normalize(query)}_ids.txt"
config_path = f"{normalize(query)}.yml"
if not os.path.exists(filename):
print(f"{query:30} | MISSING FILE")
continue
with open(filename) as f:
object_ids = [line.strip() for line in f if line.strip()]
if not object_ids:
print(f"{query:30} | 0 | 0.00")
continue
payload = {
"config_path": config_path,
"object_ids": object_ids
}
headers = {
"Content-Type": "application/json",
"Authorization": EMAIL
}
try:
response = requests.post(
"https://mercor-dev--search-eng-interview.modal.run/evaluate",
json=payload,
headers=headers
)
response.raise_for_status()
result = response.json()
print(f"{result['config_name']:30} | {result['num_candidates']:12} | {result['average_final_score']:.2f}")
except Exception as e:
print(f"{query:30} | ERROR: {str(e)}")