dlaima commited on
Commit
1e95086
·
verified ·
1 Parent(s): e8e7269

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -19
app.py CHANGED
@@ -11,7 +11,6 @@ from wikipedia_searcher import WikipediaSearcher
11
 
12
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
13
 
14
-
15
  class GaiaAgent:
16
  def __init__(self):
17
  tools = [
@@ -26,13 +25,6 @@ class GaiaAgent:
26
  tools=tools
27
  )
28
 
29
- #def __call__(self, query: str) -> str:
30
- #return self.agent.run(query)
31
-
32
- #def __call__(self, query: str) -> str:
33
- #result = self.agent.run(query)
34
- #return result.get("output", "No output returned")
35
-
36
  def __call__(self, question: str) -> str:
37
  prompt = f"""You are an agent solving the GAIA benchmark and you are required to provide exact answers.
38
  Rules to follow:
@@ -42,23 +34,19 @@ class GaiaAgent:
42
  4. For numbers, use the exact number, no other format.
43
  5. For names, use the exact name as found in sources.
44
  6. If the question has an associated file, download the file first using the task ID.
45
-
46
  Examples of good responses:
47
  - "42"
48
  - "Pinco Palla"
49
  - "Yes"
50
  - "October 5, 2001"
51
  - "Buenos Aires"
52
-
53
  Never include phrases like "the answer is..." or "Based on my research".
54
  Only return the exact answer.
55
-
56
  QUESTION:
57
  {question}
58
  """
59
  result = self.agent.run(prompt)
60
- return result.get("output", "No output returned")
61
-
62
 
63
 
64
  def run_and_submit_all(profile: gr.OAuthProfile | None):
@@ -184,12 +172,12 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
184
  # Gradio UI
185
  with gr.Blocks() as demo:
186
  gr.Markdown("# Basic Agent Evaluation Runner")
187
- gr.Markdown("""
188
- **Instructions:**
189
- 1. Clone this space and define your agent and tools.
190
- 2. Log in to your Hugging Face account using the button below.
191
- 3. Click 'Run Evaluation & Submit All Answers' to test your agent and submit results.
192
- """)
193
 
194
  gr.LoginButton()
195
  run_button = gr.Button("Run Evaluation & Submit All Answers")
 
11
 
12
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
13
 
 
14
  class GaiaAgent:
15
  def __init__(self):
16
  tools = [
 
25
  tools=tools
26
  )
27
 
 
 
 
 
 
 
 
28
  def __call__(self, question: str) -> str:
29
  prompt = f"""You are an agent solving the GAIA benchmark and you are required to provide exact answers.
30
  Rules to follow:
 
34
  4. For numbers, use the exact number, no other format.
35
  5. For names, use the exact name as found in sources.
36
  6. If the question has an associated file, download the file first using the task ID.
 
37
  Examples of good responses:
38
  - "42"
39
  - "Pinco Palla"
40
  - "Yes"
41
  - "October 5, 2001"
42
  - "Buenos Aires"
 
43
  Never include phrases like "the answer is..." or "Based on my research".
44
  Only return the exact answer.
 
45
  QUESTION:
46
  {question}
47
  """
48
  result = self.agent.run(prompt)
49
+ return result # ✅ Fixed: removed .get() since result is a string
 
50
 
51
 
52
  def run_and_submit_all(profile: gr.OAuthProfile | None):
 
172
  # Gradio UI
173
  with gr.Blocks() as demo:
174
  gr.Markdown("# Basic Agent Evaluation Runner")
175
+ gr.Markdown("""\
176
+ **Instructions:**
177
+ 1. Clone this space and define your agent and tools.
178
+ 2. Log in to your Hugging Face account using the button below.
179
+ 3. Click 'Run Evaluation & Submit All Answers' to test your agent and submit results.
180
+ """)
181
 
182
  gr.LoginButton()
183
  run_button = gr.Button("Run Evaluation & Submit All Answers")