On utils.py page there is a function called "search_images_bing " which we used to gather data for our bear classifier in lesson 2 and 3. I wanted to try it by my own by using colab but when i type the exact code for gathering data i am receiving the following error : “name ‘L’ is not defined”
The full code for the function is :
def search_images_bing(key, term, min_sz=128):
client = api('https://api.cognitive.microsoft.com', auth(key))
return L(client.images.search(query=term, count=150, min_height=min_sz, min_width=min_sz).value)
I don’t even know what type of object L is so i can’t predefine it before returning it. Also there weren’t any problems on the course despite not defining it as far as i can see.
L is a class defined in fastcore. It’s a list with added features https://github.com/fastai/fastcore/blob/master/nbs/01_foundation.ipynb, search for
For a good overview of fastcore have a look at Hamel Husain’s blog post fastcore: An Underrated Python Library.
Thank you for your answer. I installed and imported fastcore now ( i am not sure if it was needed since i imported fastai as "from fastai import * ") but still i am getting the same error “name ‘L’ is not defined”. If it is a predefined class why do i need to define it again and how can i do that ?
from fastai.vision.all import *. You certainly don’t need to define
!pip install fastai --upgrade
!pip install azure-cognitiveservices-search-imagesearch
from fastai.vision.all import *
from azure.cognitiveservices.search.imagesearch import ImageSearchClient as api
from msrest.authentication import CognitiveServicesCredentials as auth