huytofu92 commited on
Commit
fd1aa45
·
1 Parent(s): f6dabb0

Run agent again

Browse files
Files changed (2) hide show
  1. app.py +10 -10
  2. vlm_tools.py +0 -2
app.py CHANGED
@@ -82,17 +82,17 @@ def run_and_submit_all( profile: gr.OAuthProfile | None, mock_submission: bool =
82
  if not task_id or question_text is None:
83
  print(f"Skipping item with missing task_id or question: {item}")
84
  continue
85
- if "wiki" in question_text.lower() or "youtube" in question_text.lower():
86
  continue
87
- # try:
88
- # if file_path:
89
- # question_text = question_text + f"\n\nHere is also the path to the file for the task (file name matches with task ID and is not in plain English): {file_path}"
90
- # submitted_answer = agent(question_text)
91
- # answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
92
- # results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
93
- # except Exception as e:
94
- # print(f"Error running agent on task {task_id}: {e}")
95
- # results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
96
 
97
  if not answers_payload:
98
  print("Agent did not produce any answers to submit.")
 
82
  if not task_id or question_text is None:
83
  print(f"Skipping item with missing task_id or question: {item}")
84
  continue
85
+ if "youtube" in question_text.lower():
86
  continue
87
+ try:
88
+ if file_path:
89
+ question_text = question_text + f"\n\nHere is also the path to the file for the task (file name matches with task ID and is not in plain English): {file_path}"
90
+ submitted_answer = agent(question_text)
91
+ answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
92
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
93
+ except Exception as e:
94
+ print(f"Error running agent on task {task_id}: {e}")
95
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
96
 
97
  if not answers_payload:
98
  print("Agent did not produce any answers to submit.")
vlm_tools.py CHANGED
@@ -231,7 +231,6 @@ def image_processing(image: str, brightness: float = 1.0, contrast: float = 1.0)
231
  return processed_image
232
 
233
  onnx_path = "vlm_assets/yolov3-8.onnx"
234
- names_path = "vlm_assets/obj.names"
235
 
236
  class ObjectDetectionTool(Tool):
237
  name = "object_detection"
@@ -249,7 +248,6 @@ class ObjectDetectionTool(Tool):
249
  def setup(self):
250
  # Load ONNX model
251
  self.onnx_path = onnx_path
252
- self.names_path = names_path
253
  self.onnx_model = onnxruntime.InferenceSession(self.onnx_path)
254
 
255
  # Load class labels - using a predefined list since we can't use open()
 
231
  return processed_image
232
 
233
  onnx_path = "vlm_assets/yolov3-8.onnx"
 
234
 
235
  class ObjectDetectionTool(Tool):
236
  name = "object_detection"
 
248
  def setup(self):
249
  # Load ONNX model
250
  self.onnx_path = onnx_path
 
251
  self.onnx_model = onnxruntime.InferenceSession(self.onnx_path)
252
 
253
  # Load class labels - using a predefined list since we can't use open()