Spaces:
Runtime error
Runtime error
from pathlib import Path | |
import gdown | |
# from PIL import Image | |
# from numpy import asarray | |
from run import launch | |
# download | |
if not Path('./data').is_dir(): | |
url = 'https://drive.google.com/drive/folders/1hfHWDn5iXsdjB63E5zdZBAoRLWHQC3LD' | |
gdown.download_folder(url, quiet=True, use_cookies=False, output="./data/") | |
# example image from COCO data | |
image_urls = { | |
'108953': 'https://farm8.staticflickr.com/7160/6484651991_9d1eaa557a_z.jpg' | |
} | |
images = {} | |
for k, url in image_urls.items(): | |
ext = Path(url).suffix | |
output = Path(f"data/images/{k}{ext}") | |
if not output.is_file(): | |
output.parent.mkdir(exist_ok=True) | |
gdown.download(url, quiet=True, use_cookies=False, output=str(output)) | |
images[k] = str(output) | |
''' | |
for k, v in images.items(): | |
with Image.open(v) as image: | |
# image = asarray(image) | |
images[k] = image | |
''' | |
examples = [[ | |
v, | |
'My favourite recipe:', | |
20, | |
10, | |
False | |
] for v in images.values()] | |
launch(examples) | |