Not able to get Microsoft bing Image search API key

As a student ,Currently I don’t have credit card to sign in for free account of microsoft azure , that’s why i am not able to create a API key for bing image search API . Is there any alternate way to get the API key , so that i can follow up with the course partical deep learning for coder part 2 (2020)

1 Like

Microsoft has made some changes on 30 Oct, so the API seems no longer working. So as a workaround, you can use bing-image-downloader as below:

!pip install bing-image-downloader
from bing_image_downloader import downloader

downloader.download("grizzly bear", limit=150, output_dir='bears', adult_filter_off=True, force_replace=False, timeout=5)
downloader.download("black bear", limit=150, output_dir='bears', adult_filter_off=True, force_replace=False, timeout=5)
downloader.download("teddy bear", limit=150, output_dir='bears', adult_filter_off=True, force_replace=False, timeout=5)

path = Path('bears/grizzly bear')
path.rename('bears/grizzly')
path = Path('bears/black bear')
path.rename('bears/black')
path = Path('bears/teddy bear')
path.rename('bears/teddy')
3 Likes

Thank you so much rshun !!!

It didn’t work in my case! can you share your code?

just add a new cell and run the code provided by rshun to download the image set

If facing “NameError: name ‘Path’ is not defined” need to add: from pathlib import Path

I took rshun’s reply above and dropped it into place in the “clean” version of the 02_production notebook, then removed any code no longer required due to the change in download tool.

You end up with the attached image, which you can see all works fine (I am using Paperspace free tier):

Note that I got pretty terrible image results every time - usually had to delete massive amounts of them when running the later code block to do with “cleaner” - so not sure if this alternative downloader tool gives better/worse results than the one the notebook wanted us to use.