AlessandroMasala commited on
Commit
46df518
·
verified ·
1 Parent(s): 9e9f932

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,15 +3,14 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
6
- import time
7
  from agent import GaiaAgent
 
8
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
11
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
 
13
  # --- Basic Agent Definition ---
14
- # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  class BasicAgent:
16
  def __init__(self):
17
  print("BasicAgent initialized.")
@@ -82,12 +81,13 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
82
  print(f"Skipping item with missing task_id or question: {item}")
83
  continue
84
  try:
85
- submitted_answer = agent(question_text)
86
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
87
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
88
  except Exception as e:
89
  print(f"Error running agent on task {task_id}: {e}")
90
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
 
91
 
92
  if not answers_payload:
93
  print("Agent did not produce any answers to submit.")
 
3
  import requests
4
  import inspect
5
  import pandas as pd
 
6
  from agent import GaiaAgent
7
+ import time
8
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
11
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
 
13
  # --- Basic Agent Definition ---
 
14
  class BasicAgent:
15
  def __init__(self):
16
  print("BasicAgent initialized.")
 
81
  print(f"Skipping item with missing task_id or question: {item}")
82
  continue
83
  try:
84
+ submitted_answer = agent(task_id, question_text)
85
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
86
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
87
  except Exception as e:
88
  print(f"Error running agent on task {task_id}: {e}")
89
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
90
+ time.sleep(2) # Add a 2-second delay between each call
91
 
92
  if not answers_payload:
93
  print("Agent did not produce any answers to submit.")