Spaces:
Running
Running
fix bgr issues
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from ultralytics import YOLO
|
|
|
2 |
import gradio as gr
|
3 |
from huggingface_hub import snapshot_download
|
4 |
import os
|
@@ -20,7 +21,9 @@ def predict(pilimg):
|
|
20 |
# x = np.asarray(pilimg)
|
21 |
# print(x.shape)
|
22 |
result = detection_model.predict(source, conf=0.5, iou=0.6)
|
23 |
-
|
|
|
|
|
24 |
return out_pilimg
|
25 |
|
26 |
|
|
|
1 |
from ultralytics import YOLO
|
2 |
+
from PIL import Image
|
3 |
import gradio as gr
|
4 |
from huggingface_hub import snapshot_download
|
5 |
import os
|
|
|
21 |
# x = np.asarray(pilimg)
|
22 |
# print(x.shape)
|
23 |
result = detection_model.predict(source, conf=0.5, iou=0.6)
|
24 |
+
img_bgr = result[0].plot()
|
25 |
+
out_pilimg = Image.fromarray(img_bgr[..., ::-1]) # RGB-order PIL image
|
26 |
+
|
27 |
return out_pilimg
|
28 |
|
29 |
|