Spaces:
Sleeping
Sleeping
Commit ·
1cdeb8f
1
Parent(s): 7f499fe
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,19 +28,17 @@ annotatormask=sv.MaskAnnotator()
|
|
| 28 |
|
| 29 |
def yolov8_inference(
|
| 30 |
image: gr.inputs.Image = None,
|
| 31 |
-
|
| 32 |
-
image_size: gr.inputs.Slider = 640,
|
| 33 |
-
conf_threshold: gr.inputs.Slider = 0.25,
|
| 34 |
iou_threshold: gr.inputs.Slider = 0.45,
|
| 35 |
):
|
| 36 |
|
| 37 |
-
|
| 38 |
-
model = YOLO("
|
| 39 |
-
|
| 40 |
-
|
| 41 |
detections = sv.Detections.from_yolov8(results)
|
| 42 |
-
annotated_image =
|
| 43 |
-
annotated_image =
|
| 44 |
|
| 45 |
|
| 46 |
|
|
|
|
| 28 |
|
| 29 |
def yolov8_inference(
|
| 30 |
image: gr.inputs.Image = None,
|
| 31 |
+
conf_threshold: gr.inputs.Slider = 0.5,
|
|
|
|
|
|
|
| 32 |
iou_threshold: gr.inputs.Slider = 0.45,
|
| 33 |
):
|
| 34 |
|
| 35 |
+
image=image[:, :, ::-1].astype(np.uint8)
|
| 36 |
+
model = YOLO("/content/segment/train/weights/best.pt")
|
| 37 |
+
results = model(image,imgsz=640)[0]
|
| 38 |
+
image=image[:, :, ::-1].astype(np.uint8)
|
| 39 |
detections = sv.Detections.from_yolov8(results)
|
| 40 |
+
annotated_image = annotatormask.annotate(scene=image, detections=detections)
|
| 41 |
+
annotated_image = annotatorbbox.annotate(scene=annotated_image , detections=detections)
|
| 42 |
|
| 43 |
|
| 44 |
|