dawid-lorek commited on
Commit
42cbc8d
·
verified ·
1 Parent(s): 33e5fb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,18 +1,18 @@
1
- # app.py – przywrócony layout benchmarku z poprawionym wywołaniem agenta
2
-
3
  import os
4
  import requests
5
  import pandas as pd
6
  import gradio as gr
7
- import asyncio
8
 
9
- from agent import answer_question
10
 
11
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
12
 
13
  class GAIALlamaAgent:
14
- def __call__(self, question: str) -> str:
15
- return asyncio.run(answer_question(question))
 
 
 
16
 
17
  def run_and_submit_all(profile: gr.OAuthProfile | None):
18
  space_id = os.getenv("SPACE_ID")
@@ -41,7 +41,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
41
  if not task_id or question_text is None:
42
  continue
43
  try:
44
- submitted_answer = agent(question_text)
45
  except Exception as e:
46
  submitted_answer = f"[ERROR] {e}"
47
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
 
 
 
1
  import os
2
  import requests
3
  import pandas as pd
4
  import gradio as gr
 
5
 
6
+ from agent import GaiaAgent
7
 
8
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
9
 
10
  class GAIALlamaAgent:
11
+ def __init__(self):
12
+ self.agent = GaiaAgent()
13
+ def __call__(self, question: str, task_id: str) -> str:
14
+ # Pass both question and task_id to the agent
15
+ return self.agent(question, task_id)
16
 
17
  def run_and_submit_all(profile: gr.OAuthProfile | None):
18
  space_id = os.getenv("SPACE_ID")
 
41
  if not task_id or question_text is None:
42
  continue
43
  try:
44
+ submitted_answer = agent(question_text, task_id)
45
  except Exception as e:
46
  submitted_answer = f"[ERROR] {e}"
47
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})