Exodus28 commited on
Commit
db8f5f1
·
verified ·
1 Parent(s): ad602f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import inspect
5
  import pandas as pd
6
  import spaces
 
7
 
8
  @spaces.GPU
9
  def gpu_placeholder():
@@ -15,17 +16,6 @@ def gpu_placeholder():
15
  # --- Constants ---
16
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
17
 
18
- # --- Basic Agent Definition ---
19
- # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
20
- class BasicAgent:
21
- def __init__(self):
22
- print("BasicAgent initialized.")
23
- def __call__(self, question: str) -> str:
24
- print(f"Agent received question (first 50 chars): {question[:50]}...")
25
- fixed_answer = "This is a default answer."
26
- print(f"Agent returning fixed answer: {fixed_answer}")
27
- return fixed_answer
28
-
29
  def run_and_submit_all( profile: gr.OAuthProfile | None):
30
  """
31
  Fetches all questions, runs the BasicAgent on them, submits all answers,
@@ -87,7 +77,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
87
  print(f"Skipping item with missing task_id or question: {item}")
88
  continue
89
  try:
90
- submitted_answer = agent(question_text)
91
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
92
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
93
  except Exception as e:
 
4
  import inspect
5
  import pandas as pd
6
  import spaces
7
+ from agent import BasicAgent
8
 
9
  @spaces.GPU
10
  def gpu_placeholder():
 
16
  # --- Constants ---
17
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
18
 
 
 
 
 
 
 
 
 
 
 
 
19
  def run_and_submit_all( profile: gr.OAuthProfile | None):
20
  """
21
  Fetches all questions, runs the BasicAgent on them, submits all answers,
 
77
  print(f"Skipping item with missing task_id or question: {item}")
78
  continue
79
  try:
80
+ submitted_answer = agent(question_text, task_id)
81
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
82
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
83
  except Exception as e: