Update app.py
Browse files
app.py
CHANGED
|
@@ -16,11 +16,9 @@ def detect(img):
|
|
| 16 |
if isinstance(img,str):
|
| 17 |
img = get_url_img(img) if img.startswith('http') else Image.open(img).convert('RGB')
|
| 18 |
result = model.predict(source=img)
|
| 19 |
-
if len(result[0].boxes
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
# vis = plots.plot_detection(img,boxes=result[0].boxes.data,
|
| 23 |
-
# class_names=class_names, min_score=0.2)
|
| 24 |
else:
|
| 25 |
vis = img
|
| 26 |
return vis
|
|
|
|
| 16 |
if isinstance(img,str):
|
| 17 |
img = get_url_img(img) if img.startswith('http') else Image.open(img).convert('RGB')
|
| 18 |
result = model.predict(source=img)
|
| 19 |
+
if len(result[0].boxes)>0:
|
| 20 |
+
vis = plots.plot_detection(img,boxes=result[0].boxes,
|
| 21 |
+
class_names=class_names, min_score=0.2)
|
|
|
|
|
|
|
| 22 |
else:
|
| 23 |
vis = img
|
| 24 |
return vis
|