Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,11 +91,6 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 91 |
submit_url = f"{api_url}/submit"
|
| 92 |
|
| 93 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 94 |
-
try:
|
| 95 |
-
agent = BasicAgent()
|
| 96 |
-
except Exception as e:
|
| 97 |
-
print(f"Error instantiating agent: {e}")
|
| 98 |
-
return f"Error initializing agent: {e}", None
|
| 99 |
# 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)
|
| 100 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 101 |
print(agent_code)
|
|
@@ -125,9 +120,17 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 125 |
results_log = []
|
| 126 |
answers_payload = []
|
| 127 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 128 |
-
for
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
if not task_id or question_text is None:
|
| 132 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 133 |
continue
|
|
|
|
| 91 |
submit_url = f"{api_url}/submit"
|
| 92 |
|
| 93 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
# 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)
|
| 95 |
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main"
|
| 96 |
print(agent_code)
|
|
|
|
| 120 |
results_log = []
|
| 121 |
answers_payload = []
|
| 122 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 123 |
+
for question in questions_data:
|
| 124 |
+
item = question
|
| 125 |
+
task_id = question.get("task_id")
|
| 126 |
+
question_text = question["question"]
|
| 127 |
+
question_text += "\n"
|
| 128 |
+
question_text += """YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated
|
| 129 |
+
list of numbers and/or strings. If you are asked for a number, don’t use comma to write your number neither use units such as $ or
|
| 130 |
+
percent sign unless specified otherwise.
|
| 131 |
+
If you are asked for a string, don’t use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
|
| 132 |
+
If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 133 |
+
"""
|
| 134 |
if not task_id or question_text is None:
|
| 135 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 136 |
continue
|