Spaces:
Build error
Build error
Nguyen Thai Thao Uyen
commited on
Commit
·
3185613
1
Parent(s):
4036101
Add application file
Browse files
app.py
CHANGED
@@ -2,15 +2,14 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from ultralyticsplus import YOLO, render_result
|
4 |
|
5 |
-
|
6 |
torch.hub.download_url_to_file(
|
7 |
-
'https://cdn.
|
8 |
'one.jpg')
|
9 |
torch.hub.download_url_to_file(
|
10 |
-
'https://
|
11 |
'two.jpg')
|
12 |
torch.hub.download_url_to_file(
|
13 |
-
'https://
|
14 |
'three.jpg')
|
15 |
|
16 |
|
@@ -38,7 +37,7 @@ def yoloV8_func(image: gr.Image = None,
|
|
38 |
print("Probability:", box.conf)
|
39 |
|
40 |
# Render the output image with bounding boxes around detected objects
|
41 |
-
render = render_result(model=model, image=image, result=results[0])
|
42 |
return render
|
43 |
|
44 |
|
@@ -58,9 +57,9 @@ outputs = gr.Image(type="filepath", label="Output Image")
|
|
58 |
title = "YOLOv8 101: Custom Object Detection on Objects in Big Cities"
|
59 |
|
60 |
|
61 |
-
examples = [['one.jpg',
|
62 |
-
['two.jpg',
|
63 |
-
['three.jpg',
|
64 |
|
65 |
yolo_app = gr.Interface(
|
66 |
fn=yoloV8_func,
|
|
|
2 |
import torch
|
3 |
from ultralyticsplus import YOLO, render_result
|
4 |
|
|
|
5 |
torch.hub.download_url_to_file(
|
6 |
+
'https://cdn.theatlantic.com/thumbor/xoh2WVVSx4F2uboG9xbT5BDprtM=/0x0:4939x2778/960x540/media/img/mt/2023/11/LON68717_copy/original.jpg',
|
7 |
'one.jpg')
|
8 |
torch.hub.download_url_to_file(
|
9 |
+
'https://i.ytimg.com/vi/lZQX2mmLo2s/maxresdefault.jpg',
|
10 |
'two.jpg')
|
11 |
torch.hub.download_url_to_file(
|
12 |
+
'https://assets.bwbx.io/images/users/iqjWHBFdfxIU/ioQgA.854d7s/v1/-1x-1.jpg',
|
13 |
'three.jpg')
|
14 |
|
15 |
|
|
|
37 |
print("Probability:", box.conf)
|
38 |
|
39 |
# Render the output image with bounding boxes around detected objects
|
40 |
+
render = render_result(model=model, image=image, result=results[0], rect_th = 4, text_th = 4)
|
41 |
return render
|
42 |
|
43 |
|
|
|
57 |
title = "YOLOv8 101: Custom Object Detection on Objects in Big Cities"
|
58 |
|
59 |
|
60 |
+
examples = [['one.jpg', 900, 0.5, 0.8],
|
61 |
+
['two.jpg', 1152, 0.05, 0.05],
|
62 |
+
['three.jpg', 1024, 0.25, 0.25]]
|
63 |
|
64 |
yolo_app = gr.Interface(
|
65 |
fn=yoloV8_func,
|