Spaces:
Sleeping
Sleeping
Commit
·
fa56465
1
Parent(s):
c7141a5
Update app.py
Browse files
app.py
CHANGED
@@ -23,8 +23,8 @@ def detect_objects_on_image(image_path):
|
|
23 |
"NP": "Number Plate"
|
24 |
}
|
25 |
|
26 |
-
# Add
|
27 |
-
text_padding =
|
28 |
|
29 |
for box in result.boxes:
|
30 |
x1, y1, x2, y2 = [round(x) for x in box.xyxy[0].tolist()]
|
@@ -33,7 +33,7 @@ def detect_objects_on_image(image_path):
|
|
33 |
|
34 |
class_name = class_names_mapping.get(result.names[class_id], result.names[class_id])
|
35 |
|
36 |
-
# Adjust the rectangle coordinates to add space around the text
|
37 |
x1 -= text_padding
|
38 |
y1 -= text_padding
|
39 |
x2 += text_padding
|
@@ -48,7 +48,7 @@ def detect_objects_on_image(image_path):
|
|
48 |
(x1, y1),
|
49 |
(x2, y2),
|
50 |
color=(0, 0, 255),
|
51 |
-
thickness=
|
52 |
lineType=cv2.LINE_AA
|
53 |
)
|
54 |
|
|
|
23 |
"NP": "Number Plate"
|
24 |
}
|
25 |
|
26 |
+
# Add more space around the text
|
27 |
+
text_padding = 10
|
28 |
|
29 |
for box in result.boxes:
|
30 |
x1, y1, x2, y2 = [round(x) for x in box.xyxy[0].tolist()]
|
|
|
33 |
|
34 |
class_name = class_names_mapping.get(result.names[class_id], result.names[class_id])
|
35 |
|
36 |
+
# Adjust the rectangle coordinates to add more space around the text
|
37 |
x1 -= text_padding
|
38 |
y1 -= text_padding
|
39 |
x2 += text_padding
|
|
|
48 |
(x1, y1),
|
49 |
(x2, y2),
|
50 |
color=(0, 0, 255),
|
51 |
+
thickness=1,
|
52 |
lineType=cv2.LINE_AA
|
53 |
)
|
54 |
|