wishmi1234 commited on
Commit
6b34ef4
·
verified ·
1 Parent(s): 98ccefd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -151,26 +151,26 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
151
  answers_payload = []
152
  print(f"Running agent on {len(questions_data)} questions...")
153
  for item in questions_data:
154
- task_id = item.get("task_id")
155
- question_text = item.get("question")
156
- image = item.get("image", None)
157
-
158
- if not task_id or question_text is None:
159
- print(f"Skipping item with missing task_id or question: {item}")
160
- continue
161
-
162
- try:
163
- question_input = {"question": question_text}
164
- if image:
165
- question_input["image"] = {"type": "image", "data": image}
166
- submitted_answer = agent(question_input)
167
-
168
- answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
169
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
170
-
171
- except Exception as e:
172
- print(f"Error running agent on task {task_id}: {e}")
173
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
174
 
175
  if not answers_payload:
176
  print("Agent did not produce any answers to submit.")
 
151
  answers_payload = []
152
  print(f"Running agent on {len(questions_data)} questions...")
153
  for item in questions_data:
154
+ task_id = item.get("task_id")
155
+ question_text = item.get("question")
156
+ image = item.get("image", None)
157
+
158
+ if not task_id or question_text is None:
159
+ print(f"Skipping item with missing task_id or question: {item}")
160
+ continue
161
+
162
+ try:
163
+ question_input = {"question": question_text}
164
+ if image:
165
+ question_input["image"] = {"type": "image", "data": image}
166
+ submitted_answer = agent(question_input)
167
+
168
+ answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
169
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
170
+
171
+ except Exception as e:
172
+ print(f"Error running agent on task {task_id}: {e}")
173
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
174
 
175
  if not answers_payload:
176
  print("Agent did not produce any answers to submit.")