How to create an image dataset for chapter 2 of the book

In chapter 2 of the Deep Learning for Coders book (and lesson 3 of the course) we show how to download images with the Bing Image Search API.

Additionally, here is a video which walks you through the process of getting the api keys:

## DuckDuckGo

Alternatively, you can use DuckDuckGo instead of Bing. DuckDuckGo is a "privacy first" search service, with many useful features. However, they do not have an official API, so the function we'll show here relies on the particular structure of their web interface, which may change.

To use DuckDuckGo to download images, use the search_images_ddg function from fastbook, like so:

from fastbook import *
urls = search_images_ddg('grizzly bear', max_images=100)
len(urls),urls[0]

(100,
'http://wallsdesk.com/wp-content/uploads/2017/01/Grizzly-Bear-Wallpapers.jpg')

The URLs are returned as strings, so you won't need the attrgot line that's in the book:

download_url(urls[0], 'images/bear.jpg')
im = Image.open('images/bear.jpg')
im.thumbnail((256,256))
im