XeroDN commited on
Commit
ddf2a13
·
verified ·
1 Parent(s): 680c170

Update submit_gaia.py

Browse files
Files changed (1) hide show
  1. submit_gaia.py +12 -4
submit_gaia.py CHANGED
@@ -3,7 +3,7 @@ import requests
3
  from typing import List
4
  from agent import agent, AgentState
5
 
6
- API_BASE = "https://hf.space/embed/epfml/GAIA-leaderboard/+/api"
7
 
8
  # Replace with your Hugging Face username and space repo URL
9
  username = "XeroDN"
@@ -19,10 +19,18 @@ def ask_question(question: str) -> str:
19
  result = agent.invoke(state)
20
  return result["answer"]
21
 
22
- def fetch_questions() -> List[dict]:
 
23
  resp = requests.get(f"{API_BASE}/questions")
24
- resp.raise_for_status()
25
- return resp.json()
 
 
 
 
 
 
 
26
 
27
  def submit_answers(answers: List[dict]) -> dict:
28
  payload = {
 
3
  from typing import List
4
  from agent import agent, AgentState
5
 
6
+ API_BASE = "https://epfml-gaia-leaderboard.hf.space/api"
7
 
8
  # Replace with your Hugging Face username and space repo URL
9
  username = "XeroDN"
 
19
  result = agent.invoke(state)
20
  return result["answer"]
21
 
22
+ def fetch_questions():
23
+ API_BASE = "https://epfml-gaia-leaderboard.hf.space/api"
24
  resp = requests.get(f"{API_BASE}/questions")
25
+
26
+ if resp.status_code != 200:
27
+ raise RuntimeError(f"Failed to fetch questions: {resp.status_code} {resp.text}")
28
+
29
+ try:
30
+ return resp.json()
31
+ except Exception as e:
32
+ raise RuntimeError(f"Response is not valid JSON: {resp.text[:200]}")
33
+
34
 
35
  def submit_answers(answers: List[dict]) -> dict:
36
  payload = {