|
44 | 44 |
|
45 | 45 | from pathlib import Path
|
46 | 46 | from io import BytesIO
|
47 |
| -import urllib.request |
| 47 | +from urllib.request import urlopen |
48 | 48 | from zipfile import ZipFile
|
49 | 49 |
|
50 | 50 | from args import ArgContext, Arg, ModelArg
|
51 | 51 | from cases import Demo
|
52 | 52 | from data_sequences import DATA_SEQUENCES
|
53 | 53 |
|
54 | 54 | import shutil
|
| 55 | +import requests |
55 | 56 |
|
56 | 57 | scopes = {
|
57 | 58 | 'base': importlib.import_module('cases').DEMOS,
|
58 | 59 | 'performance': importlib.import_module('performance_cases').DEMOS,
|
59 | 60 | }
|
60 | 61 | COCO128_URL = "https://ultralytics.com/assets/coco128.zip"
|
61 |
| -VIDEO_URL = "https://github.com/intel-iot-devkit/sample-videos/raw/master/face-demographics-walking.mp4" |
| 62 | +VIDEO_URL = "https://storage.openvinotoolkit.org/data/test_data/videos/head-pose-face-detection-male.mp4" |
62 | 63 |
|
63 | 64 |
|
64 | 65 | def parser_paths_list(supported_devices):
|
@@ -246,12 +247,19 @@ def main():
|
246 | 247 | print(*[demo.subdirectory for demo in demos_to_test], sep =',')
|
247 | 248 | os.environ["REQUESTS_CA_BUNDLE"] = certifi.where()
|
248 | 249 | os.environ["SSL_CERT_FILE"] = certifi.where()
|
249 |
| - with urllib.request.urlopen(COCO128_URL) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded |
| 250 | + with urlopen(COCO128_URL) as zipresp: # nosec B310 # disable urllib_urlopen because url is hardcoded |
250 | 251 | with ZipFile(BytesIO(zipresp.read())) as zfile:
|
251 | 252 | zfile.extractall(args.test_data_dir)
|
252 | 253 |
|
253 |
| - fullfilename = os.path.join(args.test_data_dir, "video.mp4") |
254 |
| - urllib.request.urlopen(VIDEO_URL, fullfilename) |
| 254 | + try: |
| 255 | + r = requests.get(VIDEO_URL) |
| 256 | + with open("video.mp4", 'wb') as f: |
| 257 | + f.write(r.content) |
| 258 | + print('Video for demos downloaded successfully') |
| 259 | + shutil.copy("video.mp4", "/tmp/") |
| 260 | + except requests.exceptions.HTTPError as err: |
| 261 | + print(err) |
| 262 | + |
255 | 263 |
|
256 | 264 | with temp_dir_as_path() as global_temp_dir:
|
257 | 265 | if args.models_dir:
|
|
0 commit comments