Spaces:
Runtime error
Runtime error
File size: 1,055 Bytes
0bf81ba 61a945a 0bf81ba 61a945a 0bf81ba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
from pathlib import Path
import gdown
# from PIL import Image
# from numpy import asarray
from run import launch
# download
if not Path('./data/esper_demo').is_dir():
url = 'https://drive.google.com/drive/folders/1pfWN4WwruOuS5uiuPyPFVB9kidlCV7kc'
gdown.download_folder(url, quiet=False, use_cookies=False, output="./data/")
assert Path('./data/esper_demo').is_dir()
# 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=False, 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)
|