Hi Community,
Let me share my solution to the issue many people experiencing now when trying to run Lesson 2 notebook - bing_image_search doesn’t work.
Long story short. The search_images_bing
method from utils.py
uses Azure SDK that uses Bing API which is available if you create new Bing Search API v7 from Azure portal (Looks like microsoft is doing some changes to the services structure and bing search services).
To solve it, I created my own bing search function in my notebook, that uses requests
module only, instead of Azure Python SDK
import requests
def search_images_bing_v7(key, term, min_sz=128):
headers = {"Ocp-Apim-Subscription-Key": key}
params = {"q": term, "imageType": "photo", "count": 150, "height": min_sz, "min_width": min_sz}
response = requests.get('https://api.bing.microsoft.com/v7.0/images/search', headers=headers, params=params)
response.raise_for_status()
return L(response.json()['value'])
Rest of the notebook code that uses the method needs small adoption. Instead of getting content_url
attribute, not it is contentUrl
, e.g.:
Change any occurence of code like this results.attrgot('content_url')
into that results.attrgot('contentUrl')
.
Hope, anyone will find it useful.