Firoj112 commited on
Commit
afbbebb
·
verified ·
1 Parent(s): 271fccf

Update tools/detect_elements.py

Browse files
Files changed (1) hide show
  1. tools/detect_elements.py +11 -3
tools/detect_elements.py CHANGED
@@ -2,6 +2,7 @@ from smolagents.tools import Tool
2
  import cv2
3
  import numpy as np
4
  import os
 
5
 
6
  def detect_elements(screenshot_path, element_type="table"):
7
  """
@@ -57,12 +58,19 @@ def detect_elements(screenshot_path, element_type="table"):
57
  return f"Failed to detect elements: {str(e)}"
58
 
59
  # Register the tool
60
- tool = Tool(
61
  name="detect_elements",
62
  description="Detects table-like structures or text boxes in a screenshot using OpenCV.",
63
  inputs={
64
- "screenshot_path": {"type": "str", "description": "Path to the screenshot"},
65
- "element_type": {"type": "str", "default": "table", "description": "Type: 'table' or 'textbox'"}
 
 
 
 
 
 
 
66
  },
67
  output_type="str",
68
  function=detect_elements
 
2
  import cv2
3
  import numpy as np
4
  import os
5
+ import json
6
 
7
  def detect_elements(screenshot_path, element_type="table"):
8
  """
 
58
  return f"Failed to detect elements: {str(e)}"
59
 
60
  # Register the tool
61
+ detect_elements_tool = Tool(
62
  name="detect_elements",
63
  description="Detects table-like structures or text boxes in a screenshot using OpenCV.",
64
  inputs={
65
+ "screenshot_path": {
66
+ "type": "str",
67
+ "description": "Path to the screenshot"
68
+ },
69
+ "element_type": {
70
+ "type": "str",
71
+ "default": "table",
72
+ "description": "Type: 'table' or 'textbox'"
73
+ }
74
  },
75
  output_type="str",
76
  function=detect_elements