Add retry option to get_github_assets() function (#4148)

This commit is contained in:
Glenn Jocher
2023-08-03 19:13:50 +02:00
committed by GitHub
parent 11d0488bf1
commit 09a0378e81
4 changed files with 41 additions and 33 deletions

View File

@ -422,7 +422,7 @@ class Exporter:
f'{prefix} WARNING ⚠️ PNNX not found. Attempting to download binary file from '
'https://github.com/pnnx/pnnx/.\nNote PNNX Binary file must be placed in current working directory '
f'or in {ROOT}. See PNNX repo for full installation instructions.')
_, assets = get_github_assets(repo='pnnx/pnnx')
_, assets = get_github_assets(repo='pnnx/pnnx', retry=True)
asset = [x for x in assets if ('macos' if MACOS else 'ubuntu' if LINUX else 'windows') in x][0]
attempt_download_asset(asset, repo='pnnx/pnnx', release='latest')
unzip_dir = Path(asset).with_suffix('')

View File

@ -208,8 +208,10 @@ class Results(SimpleClass):
model = YOLO('yolov8n.pt')
results = model('bus.jpg') # results list
for r in results:
im = r.plot() # BGR numpy array
Image.fromarray(im[..., ::-1]).show() # show RGB image
im_array = r.plot() # plot a BGR numpy array of predictions
im = Image.fromarray(im[..., ::-1]) # RGB PIL image
im.show() # show image
im.save('results.jpg') # save image
```
"""
if img is None and isinstance(self.orig_img, torch.Tensor):