course22 icon indicating copy to clipboard operation
course22 copied to clipboard

Notebook 00 Is it a bird? - ImportError: cannot import name 'ddg_images'

Open JLoodts opened this issue 1 year ago • 1 comments

It seems the 1st line in the 4th cell of "00-is-it-a-bird-creating-a-model-from-your-own-data.ipynb": from duckduckgo_search import ddg_images raises an ImportError. I tried it in Colab and in Kaggle. I found a solution from altcee: https://forums.fast.ai/t/lesson-1-official-topic/95287/623?u=jloodts who referred to SergeyF: https://forums.fast.ai/t/lesson-1-official-topic/95287/608?u=jloodts I added fastbook to the !pip install line and overwrote the search_images function with def search_images(term, max_images=30): print(f"Searching for '{term}'") return search_images_ddg(term, max_images=max_images) After that the entire notebook ran without any errors. Since I am a newbee in all this, I don't know how to propose this code-change myself, but I would certainly want to learn as to keep this wonderfull fastai course notebooks working for all the other students to come. Especially now since Jeremy and co are focussing on Answer.AI.

JLoodts avatar Apr 02 '24 09:04 JLoodts

Step 1: Download images of birds and non-birds

#Skip this cell if you already have duckduckgo_search installed
!pip install -Uqq duckduckgo_search

from duckduckgo_search import DDGS
from fastcore.all import *

def search_images(term, max_images=200): return L(DDGS().images(term, max_results=max_images)).itemgot('image')

deedy5 avatar Apr 06 '24 14:04 deedy5