Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JLoodts opened this issue Apr 2, 2024 · 1 comment
Open

Comments

@JLoodts
Copy link

JLoodts commented Apr 2, 2024

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.

@deedy5
Copy link

deedy5 commented Apr 6, 2024

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants