Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,10 +63,16 @@ def extract_bounding_boxes(result):
|
|
63 |
matches = pattern.findall(result)
|
64 |
|
65 |
for match in matches:
|
|
|
66 |
x1, y1 = int(match[0][:2]), int(match[0][2:])
|
|
|
|
|
67 |
x2, y2 = int(match[1][:2]), int(match[1][2:])
|
|
|
|
|
68 |
label = match[2].strip()
|
69 |
|
|
|
70 |
bounding_boxes.append(((x1, y1, x2, y2), label))
|
71 |
|
72 |
return bounding_boxes
|
|
|
63 |
matches = pattern.findall(result)
|
64 |
|
65 |
for match in matches:
|
66 |
+
# Extract x1, y1 from the first loc tag
|
67 |
x1, y1 = int(match[0][:2]), int(match[0][2:])
|
68 |
+
|
69 |
+
# Extract x2, y2 from the second loc tag
|
70 |
x2, y2 = int(match[1][:2]), int(match[1][2:])
|
71 |
+
|
72 |
+
# Get the label
|
73 |
label = match[2].strip()
|
74 |
|
75 |
+
# Append the bounding box with the label
|
76 |
bounding_boxes.append(((x1, y1, x2, y2), label))
|
77 |
|
78 |
return bounding_boxes
|