Sborole commited on
Commit
c57654c
·
verified ·
1 Parent(s): 8a03a8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -35
app.py CHANGED
@@ -39,29 +39,19 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
39
  print(f"Error instantiating agent: {e}")
40
  return f"Error initializing agent: {e}", None
41
  # In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
42
- agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
43
- print(agent_code)
44
 
45
- # 2. Fetch Questions
46
- print(f"Fetching questions from: {questions_url}")
47
- try:
48
- response = requests.get(questions_url, timeout=15)
49
- response.raise_for_status()
50
- questions_data = response.json()
51
- if not questions_data:
52
- print("Fetched questions list is empty.")
53
- return "Fetched questions list is empty or invalid format.", None
54
- print(f"Fetched {len(questions_data)} questions.")
55
- except requests.exceptions.RequestException as e:
56
- print(f"Error fetching questions: {e}")
57
- return f"Error fetching questions: {e}", None
58
- except requests.exceptions.JSONDecodeError as e:
59
- print(f"Error decoding JSON response from questions endpoint: {e}")
60
- print(f"Response text: {response.text[:500]}")
61
- return f"Error decoding server response for questions: {e}", None
62
- except Exception as e:
63
- print(f"An unexpected error occurred fetching questions: {e}")
64
- return f"An unexpected error occurred fetching questions: {e}", None
65
 
66
  # 3. Run your Agent
67
  results_log = []
@@ -192,19 +182,6 @@ if __name__ == "__main__":
192
  print(space_host_startup)
193
  space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
194
  print(space_id_startup)
195
- ACCESS_TOKEN = os.getenv("HF_KEY")
196
-
197
- if not ACCESS_TOKEN:
198
- raise ValueError("HF_TOKEN environment variable is not set. Please set it in Space Secrets.")
199
- data_dir = snapshot_download(
200
- repo_id="gaia-benchmark/GAIA",
201
- repo_type="dataset"
202
- )
203
-
204
- dataset = load_dataset(data_dir, "2023_level1", split="test")
205
- print("Dataset", dataset)
206
- print(len(dataset))
207
- print(type(dataset))
208
 
209
  if space_host_startup:
210
  print(f"✅ SPACE_HOST found: {space_host_startup}")
 
39
  print(f"Error instantiating agent: {e}")
40
  return f"Error initializing agent: {e}", None
41
  # In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
42
+ ACCESS_TOKEN = os.getenv("HF_KEY")
 
43
 
44
+ if not ACCESS_TOKEN:
45
+ raise ValueError("HF_TOKEN environment variable is not set. Please set it in Space Secrets.")
46
+ data_dir = snapshot_download(
47
+ repo_id="gaia-benchmark/GAIA",
48
+ repo_type="dataset"
49
+ )
50
+
51
+ dataset = load_dataset(data_dir, "2023_level1", split="test")
52
+ print("Dataset", dataset)
53
+ print(len(dataset))
54
+ print(type(dataset))
 
 
 
 
 
 
 
 
 
55
 
56
  # 3. Run your Agent
57
  results_log = []
 
182
  print(space_host_startup)
183
  space_id_startup = os.getenv("SPACE_ID") # Get SPACE_ID at startup
184
  print(space_id_startup)
 
 
 
 
 
 
 
 
 
 
 
 
 
185
 
186
  if space_host_startup:
187
  print(f"✅ SPACE_HOST found: {space_host_startup}")