Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,20 +9,14 @@ model = None
|
|
| 9 |
def predict_image(img):
|
| 10 |
"""Predicts objects in an image using a YOLOv8 model with adjustable confidence and IOU thresholds."""
|
| 11 |
model = YOLO("best")
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
for r in results:
|
| 22 |
-
im_array = r.plot()
|
| 23 |
-
im = Image.fromarray(im_array[..., ::-1])
|
| 24 |
-
|
| 25 |
-
return im
|
| 26 |
|
| 27 |
|
| 28 |
demo = gr.Interface(
|
|
|
|
| 9 |
def predict_image(img):
|
| 10 |
"""Predicts objects in an image using a YOLOv8 model with adjustable confidence and IOU thresholds."""
|
| 11 |
model = YOLO("best")
|
| 12 |
+
model.predict(source=img, save=True)
|
| 13 |
+
results = model(img)
|
| 14 |
+
|
| 15 |
+
# for r in results:
|
| 16 |
+
# im_array = r.plot()
|
| 17 |
+
# im = Image.fromarray(im_array[..., ::-1])
|
| 18 |
+
|
| 19 |
+
return results[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
demo = gr.Interface(
|