Spaces:
Running
Running
Update tools/detect_elements.py
Browse files- tools/detect_elements.py +4 -6
tools/detect_elements.py
CHANGED
@@ -8,14 +8,12 @@ class DetectElementsTool(Tool):
|
|
8 |
name = "detect_elements"
|
9 |
description = "Detects table-like structures or text boxes in a screenshot using OpenCV."
|
10 |
inputs = {
|
11 |
-
"screenshot_path": {"type": "
|
12 |
-
"element_type": {"type": "
|
13 |
}
|
14 |
-
output_type = "
|
15 |
|
16 |
-
def forward(self,
|
17 |
-
screenshot_path = kwargs.get("screenshot_path")
|
18 |
-
element_type = kwargs.get("element_type", "table")
|
19 |
try:
|
20 |
if not os.path.exists(screenshot_path):
|
21 |
return f"Screenshot not found: {screenshot_path}"
|
|
|
8 |
name = "detect_elements"
|
9 |
description = "Detects table-like structures or text boxes in a screenshot using OpenCV."
|
10 |
inputs = {
|
11 |
+
"screenshot_path": {"type": "string", "description": "Path to the screenshot"},
|
12 |
+
"element_type": {"type": "string", "default": "table", "description": "Type: 'table' or 'textbox'"}
|
13 |
}
|
14 |
+
output_type = "string"
|
15 |
|
16 |
+
def forward(self, screenshot_path, element_type="table"):
|
|
|
|
|
17 |
try:
|
18 |
if not os.path.exists(screenshot_path):
|
19 |
return f"Screenshot not found: {screenshot_path}"
|