Spaces:
Running
Running
Colin N. Paterson
commited on
Commit
·
682a61a
1
Parent(s):
477247e
First from Laptop
Browse files
app.py
CHANGED
@@ -93,16 +93,19 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
93 |
results_log = []
|
94 |
answers_payload = []
|
95 |
print(f"Running agent on (a few) {len(questions_data)} questions...")
|
|
|
96 |
for item in questions_data:
|
97 |
-
|
|
|
98 |
question_text = item.get("question")
|
99 |
if not task_id or question_text is None:
|
100 |
print(f"Skipping item with missing task_id or question: {item}")
|
101 |
continue
|
102 |
try:
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
106 |
except Exception as e:
|
107 |
print(f"Error running agent on task {task_id}: {e}")
|
108 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
93 |
results_log = []
|
94 |
answers_payload = []
|
95 |
print(f"Running agent on (a few) {len(questions_data)} questions...")
|
96 |
+
n_item = 0
|
97 |
for item in questions_data:
|
98 |
+
n_item = n_item + 1
|
99 |
+
task_id = item.get("task_in_itemd")
|
100 |
question_text = item.get("question")
|
101 |
if not task_id or question_text is None:
|
102 |
print(f"Skipping item with missing task_id or question: {item}")
|
103 |
continue
|
104 |
try:
|
105 |
+
if (n_item <= 1):
|
106 |
+
submitted_answer = agent.run(question_text)
|
107 |
+
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
108 |
+
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
109 |
except Exception as e:
|
110 |
print(f"Error running agent on task {task_id}: {e}")
|
111 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|