Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from sahi.prediction import ObjectPrediction
|
4 |
-
from sahi.utils.cv import visualize_object_predictions, read_image
|
|
|
|
|
|
|
5 |
from ultralyticsplus import YOLO, render_result
|
6 |
|
7 |
# from ultralyticsplus import render_result
|
@@ -19,7 +22,7 @@ image_path = [['test_images/2a998cfb0901db5f8210.jpg','linhcuem/chamdiem_yolov8_
|
|
19 |
['test_images/ee106392e56837366e79.jpg','linhcuem/chamdiem_yolov8_ver10', 640, 0.25, 0.45], ['test_images/f88d2214a4ee76b02fff.jpg','linhcuem/chamdiem_yolov8_ver10', 640, 0.25, 0.45]]
|
20 |
|
21 |
# Load YOLO model
|
22 |
-
model = YOLO('linhcuem/
|
23 |
|
24 |
###################################################
|
25 |
def yolov8_img_inference(
|
@@ -36,10 +39,11 @@ def yolov8_img_inference(
|
|
36 |
model.overrides['iou'] = iou_threshold
|
37 |
model.overrides['agnostic_nms'] = False
|
38 |
model.overrides['max_det'] = 1000
|
39 |
-
image = read_image
|
40 |
results = model.predict(image)
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
# results = model.predict(image, imgsz=image_size, return_outputs=True)
|
45 |
# results = model.predict(image)
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
# from sahi.prediction import ObjectPrediction
|
4 |
+
# from sahi.utils.cv import visualize_object_predictions, read_image
|
5 |
+
import os
|
6 |
+
import requests
|
7 |
+
|
8 |
from ultralyticsplus import YOLO, render_result
|
9 |
|
10 |
# from ultralyticsplus import render_result
|
|
|
22 |
['test_images/ee106392e56837366e79.jpg','linhcuem/chamdiem_yolov8_ver10', 640, 0.25, 0.45], ['test_images/f88d2214a4ee76b02fff.jpg','linhcuem/chamdiem_yolov8_ver10', 640, 0.25, 0.45]]
|
23 |
|
24 |
# Load YOLO model
|
25 |
+
model = YOLO('linhcuem/chamdiem_yolov8_ver10')
|
26 |
|
27 |
###################################################
|
28 |
def yolov8_img_inference(
|
|
|
39 |
model.overrides['iou'] = iou_threshold
|
40 |
model.overrides['agnostic_nms'] = False
|
41 |
model.overrides['max_det'] = 1000
|
42 |
+
# image = read_image
|
43 |
results = model.predict(image)
|
44 |
+
render = render_result(model=model, image=image, result=results[0])
|
45 |
+
|
46 |
+
return render
|
47 |
|
48 |
# results = model.predict(image, imgsz=image_size, return_outputs=True)
|
49 |
# results = model.predict(image)
|