Spaces:
Running
Running
Update tools/detect_elements.py
Browse files- tools/detect_elements.py +2 -1
tools/detect_elements.py
CHANGED
@@ -3,6 +3,7 @@ import cv2
|
|
3 |
import numpy as np
|
4 |
import os
|
5 |
import json
|
|
|
6 |
|
7 |
class DetectElementsTool(Tool):
|
8 |
name = "detect_elements"
|
@@ -13,7 +14,7 @@ class DetectElementsTool(Tool):
|
|
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}"
|
|
|
3 |
import numpy as np
|
4 |
import os
|
5 |
import json
|
6 |
+
from typing import Optional
|
7 |
|
8 |
class DetectElementsTool(Tool):
|
9 |
name = "detect_elements"
|
|
|
14 |
}
|
15 |
output_type = "string"
|
16 |
|
17 |
+
def forward(self, screenshot_path: Optional[str], element_type="table"):
|
18 |
try:
|
19 |
if not os.path.exists(screenshot_path):
|
20 |
return f"Screenshot not found: {screenshot_path}"
|