Spaces:
Running
Running
Sample video path added
Browse files
app.py
CHANGED
@@ -8,7 +8,8 @@ from ultralytics import YOLO
|
|
8 |
|
9 |
file_urls = [
|
10 |
'https://www.dropbox.com/s/b5g97xo901zb3ds/pothole_example.jpg?dl=1',
|
11 |
-
'https://www.dropbox.com/s/86uxlxxlm1iaexa/pothole_screenshot.png?dl=1'
|
|
|
12 |
]
|
13 |
|
14 |
def download_file(url, save_name):
|
@@ -17,14 +18,21 @@ def download_file(url, 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 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
model = YOLO('best.pt')
|
27 |
path = [['image_0.jpg'], ['image_1.jpg']]
|
|
|
28 |
|
29 |
def show_preds_image(image_path):
|
30 |
image = cv2.imread(image_path)
|
@@ -93,7 +101,7 @@ interface_video = gr.Interface(
|
|
93 |
inputs=inputs_video,
|
94 |
outputs=outputs_video,
|
95 |
title="Pothole detector",
|
96 |
-
|
97 |
cache_examples=False,
|
98 |
# live=True,
|
99 |
)
|
|
|
8 |
|
9 |
file_urls = [
|
10 |
'https://www.dropbox.com/s/b5g97xo901zb3ds/pothole_example.jpg?dl=1',
|
11 |
+
'https://www.dropbox.com/s/86uxlxxlm1iaexa/pothole_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):
|
|
|
18 |
file = requests.get(url)
|
19 |
open(save_name, 'wb').write(file.content)
|
20 |
|
21 |
+
for i, url in enumerate(file_urls):
|
22 |
+
if 'mp4' in file_urls[i]:
|
23 |
+
download_file(
|
24 |
+
file_urls[i],
|
25 |
+
f"video.mp4"
|
26 |
+
)
|
27 |
+
else:
|
28 |
+
download_file(
|
29 |
+
file_urls[i],
|
30 |
+
f"image_{i}.jpg"
|
31 |
+
)
|
32 |
|
33 |
model = YOLO('best.pt')
|
34 |
path = [['image_0.jpg'], ['image_1.jpg']]
|
35 |
+
video_path = [['video.mp4']]
|
36 |
|
37 |
def show_preds_image(image_path):
|
38 |
image = cv2.imread(image_path)
|
|
|
101 |
inputs=inputs_video,
|
102 |
outputs=outputs_video,
|
103 |
title="Pothole detector",
|
104 |
+
examples=video_path,
|
105 |
cache_examples=False,
|
106 |
# live=True,
|
107 |
)
|