I’m trying to download the images for the grizzly bears in Chapter 2 without success. I’m working through the book and I’m using Colab. My attempts are below.
Can anybody please provide some guidance? I don’t know which folder the images are being saved to…
Much appreciated.
#hide
!pip install -Uqq fastbook
import fastbook
fastbook.setup_book()
#hide
from fastbook import *
from fastai.vision.widgets import *
key = os.environ.get(‘AZURE_SEARCH_KEY’, ‘xxx’)
results = search_images_bing(key, ‘grizzly bear’)
ims = results.attrgot(‘content_url’)
len(ims)
dest = ‘images/grizzly.jpg’
download_url(ims[0], dest)
im = Image.open(dest)
im.to_thumb(128,128)
MissingSchema Traceback (most recent call last)
in ()
1 dest = ‘images/grizzly.jpg’
----> 2 download_url(ims[0], dest)
3
4 im = Image.open(dest)
5 im.to_thumb(128,128)
5 frames
/usr/local/lib/python3.6/dist-packages/requests/models.py in prepare_url(self, url, params)
386 error = error.format(to_native_string(url, ‘utf8’))
387
–> 388 raise MissingSchema(error)
389
390 if not host:
MissingSchema: Invalid URL ‘None’: No schema supplied. Perhaps you meant http://None?
There is an additional certificate error bug in some environments that prevents this from running that appears to have been closed:
According to the report, it’s been resolved for Paperspace instances, but it’s still broken in Google Colab. You’ll probably need to switch to Paperspace to keep working through book.
Thanks Poodleman. Yes, I was having some teething issues with using Colab. I haven’t used Paperspace yet but will look into it if that is slicker with the FastAI API.