def load_photos(images: Path, cache_dir: Union[(Path, str)]) -> List[Union[(str, Path)]]:
    photo_cache = (Path(cache_dir) / 'photos.txt')
    if photo_cache.is_file():
        with open(photo_cache, 'r') as fid:
            photos: List[Union[(str, Path)]] = [l.strip() for l in fid.readlines()]
    else:
        print('Preloading every images')
        photos = list(images.rglob('*.jpg'))
        with open(photo_cache, 'w') as fid:
            fid.writelines((f'''{l}
''' for l in photos))
    return photos
def load_photos(images: Path, cache_dir: Union[(Path, str)]) -> List[Union[(str, Path)]]:
    photo_cache = (Path(cache_dir) / 'photos.txt')
    if photo_cache.is_file():
        with open(photo_cache, 'r') as fid:
            photos: List[Union[(str, Path)]] = [l.strip() for l in fid.readlines()]
    else:
        print('Preloading every images')
        photos = list(images.rglob('*.jpg'))
        with open(photo_cache, 'w') as fid:
            fid.writelines((f'{l}
' for l in photos))
    return photos