Nicolas PHUNG
commited on
Commit
·
5f566ec
1
Parent(s):
bf547e2
fix: Fix post Hack
Browse files
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}
|
81 |
)
|
82 |
else:
|
83 |
-
submitted_answer = (
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
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 |
)
|