dwkurnie
commited on
Commit
·
458ae63
1
Parent(s):
6da4103
app.py
CHANGED
@@ -6,28 +6,28 @@ import numpy as np
|
|
6 |
|
7 |
from ultralytics import YOLO
|
8 |
|
9 |
-
file_urls = [
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
]
|
14 |
|
15 |
-
def download_file(url, save_name):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
for i, url in enumerate(file_urls):
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
model = YOLO('best.pt')
|
33 |
path = [['1.jpeg'], ['2.jpeg']]
|
@@ -90,24 +90,24 @@ interface_image = gr.Interface(
|
|
90 |
fn=show_preds_image,
|
91 |
inputs=inputs_image,
|
92 |
outputs=outputs_image,
|
93 |
-
title="
|
94 |
examples=path,
|
95 |
cache_examples=False,
|
96 |
)
|
97 |
|
98 |
inputs_video = gr.Video(label="Input Video")
|
99 |
-
outputs_video = gr.
|
100 |
interface_video = gr.Interface(
|
101 |
fn=show_preds_video,
|
102 |
inputs=inputs_video,
|
103 |
outputs=outputs_video,
|
104 |
-
title="
|
105 |
examples=video_path,
|
106 |
cache_examples=False,
|
107 |
)
|
108 |
|
109 |
-
inputs_webcam = gr.
|
110 |
-
outputs_webcam = gr.
|
111 |
interface_webcam = gr.Interface(
|
112 |
fn=show_preds_webcam,
|
113 |
inputs=inputs_webcam,
|
|
|
6 |
|
7 |
from ultralytics import YOLO
|
8 |
|
9 |
+
# file_urls = [
|
10 |
+
# 'https://www.dropbox.com/s/b5g97xo901zb3ds/Garbage_example.jpg?dl=1',
|
11 |
+
# 'https://www.dropbox.com/s/86uxlxxlm1iaexa/Garbage_screenshot.png?dl=1',
|
12 |
+
# 'https://www.dropbox.com/s/7sjfwncffg8xej2/video_7.mp4?dl=1'
|
13 |
+
# ]
|
14 |
|
15 |
+
# def download_file(url, save_name):
|
16 |
+
# if not os.path.exists(save_name):
|
17 |
+
# file = requests.get(url)
|
18 |
+
# open(save_name, 'wb').write(file.content)
|
19 |
|
20 |
+
# for i, url in enumerate(file_urls):
|
21 |
+
# if 'mp4' in file_urls[i]:
|
22 |
+
# download_file(
|
23 |
+
# file_urls[i],
|
24 |
+
# f"video.mp4"
|
25 |
+
# )
|
26 |
+
# else:
|
27 |
+
# download_file(
|
28 |
+
# file_urls[i],
|
29 |
+
# f"image_{i}.jpg"
|
30 |
+
# )
|
31 |
|
32 |
model = YOLO('best.pt')
|
33 |
path = [['1.jpeg'], ['2.jpeg']]
|
|
|
90 |
fn=show_preds_image,
|
91 |
inputs=inputs_image,
|
92 |
outputs=outputs_image,
|
93 |
+
title="Garbage Detection",
|
94 |
examples=path,
|
95 |
cache_examples=False,
|
96 |
)
|
97 |
|
98 |
inputs_video = gr.Video(label="Input Video")
|
99 |
+
outputs_video = gr.Video(label="Output Image")
|
100 |
interface_video = gr.Interface(
|
101 |
fn=show_preds_video,
|
102 |
inputs=inputs_video,
|
103 |
outputs=outputs_video,
|
104 |
+
title="Garbage Detection",
|
105 |
examples=video_path,
|
106 |
cache_examples=False,
|
107 |
)
|
108 |
|
109 |
+
inputs_webcam = gr.Video(sources="webcam", streaming=True)
|
110 |
+
outputs_webcam = gr.Video(label="Output Image")
|
111 |
interface_webcam = gr.Interface(
|
112 |
fn=show_preds_webcam,
|
113 |
inputs=inputs_webcam,
|