Aurele000 commited on
Commit
2c832b2
·
1 Parent(s): 54408cb

correction agent

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -11,14 +11,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
11
  api_open_ai_agent_key=os.environ["OPENAI_API_KEY"]
12
  # --- Basic Agent Definition ---
13
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
14
- class BasicAgent:
15
- def __init__(self):
16
 
17
- self.my_agent = supervisor
18
- def __call__(self, question: str) -> str:
19
- print(f"Agent received question (first 50 chars): {question[:50]}...")
20
- fixed_answer = response_from_agent(question)
21
- return fixed_answer
22
 
23
  def run_and_submit_all( profile: gr.OAuthProfile | None):
24
  """
@@ -39,12 +32,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
39
  questions_url = f"{api_url}/questions"
40
  submit_url = f"{api_url}/submit"
41
 
42
- # 1. Instantiate Agent ( modify this part to create your agent)
43
- try:
44
- agent = BasicAgent()
45
- except Exception as e:
46
- print(f"Error instantiating agent: {e}")
47
- return f"Error initializing agent: {e}", None
48
  # 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)
49
  agent_code = 'https://huggingface.co/spaces/Aurele000/Final_Assignment_Template/tree/main'
50
  print(agent_code)
@@ -81,7 +70,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
81
  print(f"Skipping item with missing task_id or question: {item}")
82
  continue
83
  try:
84
- submitted_answer = agent(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:
 
11
  api_open_ai_agent_key=os.environ["OPENAI_API_KEY"]
12
  # --- Basic Agent Definition ---
13
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
 
 
14
 
 
 
 
 
 
15
 
16
  def run_and_submit_all( profile: gr.OAuthProfile | None):
17
  """
 
32
  questions_url = f"{api_url}/questions"
33
  submit_url = f"{api_url}/submit"
34
 
35
+
36
+
 
 
 
 
37
  # 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)
38
  agent_code = 'https://huggingface.co/spaces/Aurele000/Final_Assignment_Template/tree/main'
39
  print(agent_code)
 
70
  print(f"Skipping item with missing task_id or question: {item}")
71
  continue
72
  try:
73
+ submitted_answer = response_from_agent(question_text)
74
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
75
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
76
  except Exception as e: