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)