Getting The Bing Image Search key

Hi @russnagel1, you may want to try this other option :

1 Like


Thank you for helping. Here is what I entered.

@nn.Charles @russnagel1
Hi there,

I have tried both solutions posted and have not had any success. If anyone does have a working solution please upload a screenshot of your code working or a link to your notebook so that I and others may debug further and look into the issue.

This code below I entered in the cell below


!pip install bing-image-downloader from bing_image_downloader
import downloader
for q in ["grizzly", "black bear”, “teddy bear"]:, limit=20, output_dir='bears', adult_filter_off=True, force_replace=False, timeout=5)

Edit: This is a community where we seek to grow together and further our skillset in deep learning. I do understand that some of you have solutions for this issue but a reminder please provide documentation and exact setup so that we may attain similar results.

1 Like

This just worked for me. Note it only downloaded 20 images per ‘limit = 20’ in the last line of code. Let me know how it works for you.


Hi @Alignedmind, @russnagel1,

This worked for me in Gradient.

I am using gradient as well.

Hi @russnagel1,@nn.Charles

Awesome that was tremendous team-work, I’m so very happy that this work-around is running. Hopefully the authors take notice of this issue and adopt this work-around or produce one themselves. Thank you team and keep on deep learning :smile: !


Edit: I used a server with 2gb ram, I upgraded to 30gb, everything is working fine.

Hi there !,

I am revisiting this thread as I had a question regarding the code work around. In the cell where in which “we can now create our Learner and fine-tune it” , I am presented with this error.

RuntimeError: DataLoader worker (pid 8417) is killed by signal: Killed.

Does this error have correlation to the work-around ?, and if not what can it be? I’m currently using gradient and the free server option.

I had the same problem and It worked for me!
Thanks! Happy learning!

Hi all, I have consolidated the code I shared above, and wrote a Towards Data Science Medium article about how to leverage the updated Bing Search V7 API together with the capabilities for this lesson. Feel free to have a look!

1 Like

And here is the Medium post as mentioned, containing the full updated code that works:


Wow, thank you a lot!
I have run into one weird problem with it: was not working and I had to import PIL.Image (instead of from PIL import Image) and later in each instance use and besides that works smoothly!

Thanks for sharing this! Will amend the import in the article :slight_smile:

Great article Kenneth!
I looked through the article and I can see I will learn a lot as I go through it slowly to really understand what you did.

1 Like

Did you continue with the lesson after downloading the images? I went out of town and I am just now getting back to this. I had a problem with the next cell. Did you work around the issue with the first line in the next cell 'results = search_images_bing(key, ‘grizzly_bear’).

If so, please let me know what you did.

this question removed. Not the one above.

@russnagel1 Hi Russ, I hope all is well. Please provide a code sample of your error so that I can better assist you. I have been able to get the entire model into production via binder and made my own variation.

This is what I get.

If I comment out the following code as seen below:

I get the following error.

@russnagel1 Hi Russ, try giving this a try this is different method to get the images.

Use this instead:

!pip install bing-image-downloader

Followed by:

image_downloader import downloader
for q in ["Black Bear","Grizzly Bear","Teddy Bear"]:, limit=150, output_dir='bears', adult_filter_off=True, force_replace=False, timeout=5)

Assign your bears to the path ‘bears’:

bear_types = 'Black Bear','Grizzly Bear','Teddy Bear'
path = Path('bears')
1 Like