diff --git a/demo.ipynb b/demo.ipynb index a5795fd3b..9c3390269 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -75,6 +75,7 @@ "from shutil import copyfileobj\n", "from skimage import img_as_ubyte\n", "from tempfile import NamedTemporaryFile\n", + "from tqdm.auto import tqdm\n", "warnings.filterwarnings(\"ignore\")\n", "os.makedirs(\"user\", exist_ok=True)\n", "\n", @@ -467,9 +468,12 @@ "\tloading.layout.display = ''\n", "\tfilename = model.value + ('' if model.value == 'fashion' else '-cpk') + '.pth.tar'\n", "\tif not os.path.isfile(filename):\n", - "\t\tdownload = requests.get(requests.get('https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key=https://yadi.sk/d/lEw8uRm140L_eQ&path=/' + filename).json().get('href'))\n", - "\t\twith open(filename, 'wb') as checkpoint:\n", - "\t\t\tcheckpoint.write(download.content)\n", + "\t\tresponse = requests.get('https://github.com/graphemecluster/first-order-model-demo/releases/download/checkpoints/' + filename, stream=True)\n", + "\t\twith progress_bar:\n", + "\t\t\twith tqdm.wrapattr(response.raw, 'read', total=int(response.headers.get('Content-Length', 0)), unit='B', unit_scale=True, unit_divisor=1024) as raw:\n", + "\t\t\t\twith open(filename, 'wb') as file:\n", + "\t\t\t\t\tcopyfileobj(raw, file)\n", + "\t\tprogress_bar.clear_output()\n", "\treader = imageio.get_reader(selected_video, mode='I', format='FFMPEG')\n", "\tfps = reader.get_meta_data()['fps']\n", "\tdriving_video = []\n",