Nicolas PHUNG commited on
Commit
5f566ec
·
1 Parent(s): bf547e2

fix: Fix post Hack

Browse files
Files changed (1) hide show
  1. app.py +17 -11
app.py CHANGED
@@ -6,6 +6,8 @@ import requests
6
 
7
  from agent import MyAgent
8
 
 
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
11
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
@@ -76,19 +78,23 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
76
  try:
77
  if file_name:
78
  submitted_answer = agent(
79
- question_text
80
- + f"\n\nMentionned case sentitive file path is {os.getenv('GAIA_CONTENT_PATH')}{file_name}\n\ncorn starch right typo is cornstarch"
81
  )
82
  else:
83
- submitted_answer = (
84
- str(agent(question_text))
85
- # Post Hack on the answer to remove some common mistakes
86
- .replace("$", "")
87
- .replace(".", "")
88
- .replace("St Petersburg", "Saint Petersburg")
89
- .replace("USD", "")
90
- .strip()
91
- )
 
 
 
 
92
  answers_payload.append(
93
  {"task_id": task_id, "submitted_answer": submitted_answer}
94
  )
 
6
 
7
  from agent import MyAgent
8
 
9
+ # from private_agent import PrivateAgent
10
+
11
  # (Keep Constants as is)
12
  # --- Constants ---
13
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
 
78
  try:
79
  if file_name:
80
  submitted_answer = agent(
81
+ question=question_text
82
+ + f"\n\nMentionned case sentitive file path is {os.getenv('GAIA_CONTENT_PATH')}{file_name}"
83
  )
84
  else:
85
+ submitted_answer = str(agent(question_text))
86
+ submitted_answer = (
87
+ str(submitted_answer)
88
+ .strip()
89
+ # Post Hack on the answer to remove some common mistakes
90
+ .replace("$", "")
91
+ .removesuffix(".")
92
+ .replace("St. Petersburg", "Saint Petersburg")
93
+ .replace("St Petersburg", "Saint Petersburg")
94
+ .replace("USD", "")
95
+ .replace("corn starch", "cornstarch")
96
+ .strip()
97
+ )
98
  answers_payload.append(
99
  {"task_id": task_id, "submitted_answer": submitted_answer}
100
  )