Getting The Bing Image Search key

In chapter 2 (production.ipynb) of fastbook, we are required to get the Bing Image Search API key from Microsoft. Some of my study group mates had problems getting the key and @go_go_gadget suggested I share the solution in the forum in case others are finding it difficult too :slight_smile:.
Here are the steps I followed:

Hope someone finds it useful.

70 Likes

Thanks again, Ivy! I’ve heard others say they spent quite a while trying to get their API key, and this was so fast and easy.

2 Likes

Has anyone been able to avoid providing a phone number? I live an hour from cell service, so I can’t get past the verification call/text.

Also, is Bing Image Search better than using the JavaScript snippet that scrapes google images (provided in lesson 2 of cours-v3?)

If it is not much better, I may not waste my time trying to sign up for Bing.

Thank you @Ivy for this piece. I sent hours trying to get to the right place until I decide to check with the forum.

2 Likes

Thanks @Ivy for this

1 Like

Thanks @Ivy! Saved me quite sometime setting this up.

1 Like

My issue is that I dont have a credit card, only a debit card, and it wont accept that. Have you guys stumbled upon any other Image search APIs? Ideally a free one?( I mean, totally free…not a temporarily free one)

2 Likes

Precious! Took me ages to figure out on my own, thanks for posting

Hi, I’m having trouble to follow the guidelines of downloading the bing images, according to what’s in here
https://github.com/fastai/fastbook/blob/master/02_production.ipynb I have to write in a cell of my jupyter notebook:
key = ‘my_key’
results = search_images_bing(key, ‘grizzly bear’)
But I get NameError: name ‘search_images_bing’ is not defined. What it’s missing?

that “search_images_bing” should be in use with “utils” class which is included in notebooks (when used online). Have you imported utils just like it is written to notebook.

There is also text in the notebook : " Once you’ve set key , you can use search_images_bing . This function is provided by the small utils class included with the notebooks online. If you’re not sure where a function is defined, you can just type it in your notebook to find out:"

Hopefully this helps you.

Where exactly can I see the utils class?

1 Like

So, this is a small file in the fastbook repo. If you’re running the notebooks from the git repo, it’s in the first cell of the notebook.

If you’re running a different notebook, you can import the dependencies from this file.

If you don’t have the dependencies installed, you can download the requirements.txt file and install them with pip install -r requirements.txt.

That was super useful, thank you! I’ve never worked with azure before, and did not find the site intuitive. These directions were exactly what I needed!

1 Like

I specifically signed up to the forums to say THANK YOU IVY.
Wasted a good couple hours wandering around the azure website, then found this and worked out in a second.

2 Likes

You rock!

1 Like

could you be able to try both? which one is better?

I tried creating an azure account and i ran into this problem whenever i enter the postal code: “Incorrectly formatted postal code”. I tried contacting their support but no help. I was wondering if anyone had similar issue

thanks!

Thanks for taking the time to post this Ivy. Anybody knows what happens after the 7 day free trial. Do we need to start paying or just live with reduced features.

It is probably the second import statement

from fastbook import *

from fastai.vision.widgets import *