Update app.py
Browse files
app.py
CHANGED
|
@@ -256,7 +256,7 @@ def detect_objects_video(model_name, video_input, threshold):
|
|
| 256 |
labels = [model.config.id2label[x] for x in labels]
|
| 257 |
|
| 258 |
for score, (xmin, ymin, xmax, ymax), label in zip(scores, boxes, labels):
|
| 259 |
-
if
|
| 260 |
crop = pil_img.crop((int(xmin), int(ymin), int(xmax), int(ymax)))
|
| 261 |
plate_type = classify_plate_color(crop)
|
| 262 |
|
|
@@ -290,19 +290,13 @@ def detect_objects_video(model_name, video_input, threshold):
|
|
| 290 |
title = """<h1 id="title">Smart Vehicle Clssification (Image + Video)</h1>"""
|
| 291 |
|
| 292 |
description = """
|
| 293 |
-
Detect license plates using YOLOS or DETR.
|
| 294 |
-
Supports:
|
| 295 |
-
- Image URL
|
| 296 |
-
- Image Upload
|
| 297 |
-
- Webcam
|
| 298 |
-
- Video Upload
|
| 299 |
-
- Vehicle type classification by plate color
|
| 300 |
"""
|
| 301 |
|
| 302 |
-
models = [
|
| 303 |
-
"nickmuchi/yolos-small-finetuned-license-plate-detection"
|
| 304 |
-
]
|
| 305 |
-
|
| 306 |
css = '''
|
| 307 |
h1#title {
|
| 308 |
text-align: center;
|
|
|
|
| 256 |
labels = [model.config.id2label[x] for x in labels]
|
| 257 |
|
| 258 |
for score, (xmin, ymin, xmax, ymax), label in zip(scores, boxes, labels):
|
| 259 |
+
if "plate" in label.lower()::
|
| 260 |
crop = pil_img.crop((int(xmin), int(ymin), int(xmax), int(ymax)))
|
| 261 |
plate_type = classify_plate_color(crop)
|
| 262 |
|
|
|
|
| 290 |
title = """<h1 id="title">Smart Vehicle Clssification (Image + Video)</h1>"""
|
| 291 |
|
| 292 |
description = """
|
| 293 |
+
Detect license plates using YOLOS or DETR and Vehicle classification.
|
| 294 |
+
Supports:Image URL, Image Upload, Webcam, Video Upload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
"""
|
| 296 |
|
| 297 |
+
#models = [
|
| 298 |
+
# "nickmuchi/yolos-small-finetuned-license-plate-detection"
|
| 299 |
+
#]
|
|
|
|
| 300 |
css = '''
|
| 301 |
h1#title {
|
| 302 |
text-align: center;
|