Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,20 +56,20 @@ def visualize_prediction(img, output_dict, threshold=0.5, id2label=None):
|
|
| 56 |
ax = plt.gca()
|
| 57 |
colors = COLORS * 100
|
| 58 |
for score, (xmin, ymin, xmax, ymax), label, color in zip(scores, boxes, labels, colors):
|
| 59 |
-
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
ax.add_patch(
|
| 75 |
plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin,
|
|
|
|
| 56 |
ax = plt.gca()
|
| 57 |
colors = COLORS * 100
|
| 58 |
for score, (xmin, ymin, xmax, ymax), label, color in zip(scores, boxes, labels, colors):
|
| 59 |
+
if label == 'license-plates':
|
| 60 |
|
| 61 |
+
# Crop plate
|
| 62 |
+
plate_crop = img.crop((xmin, ymin, xmax, ymax))
|
| 63 |
|
| 64 |
+
# Check EV
|
| 65 |
+
ev = is_green_plate(plate_crop)
|
| 66 |
|
| 67 |
+
if ev:
|
| 68 |
+
plate_type = "EV (Green Plate)"
|
| 69 |
+
box_color = "green"
|
| 70 |
+
else:
|
| 71 |
+
plate_type = "Non-EV Plate"
|
| 72 |
+
box_color = "red"
|
| 73 |
|
| 74 |
ax.add_patch(
|
| 75 |
plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin,
|