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

image_cat() not defined error #55

Open
sumitpowar opened this issue Apr 23, 2021 · 3 comments
Open

image_cat() not defined error #55

sumitpowar opened this issue Apr 23, 2021 · 3 comments

Comments

@sumitpowar
Copy link

HI,

What is image_cat() in the following code (given in lesson 1)?

img = PILImage.create(image_cat())
img.to_thumb(192)

It gives following error after running it:

**NameError Traceback (most recent call last)
in
----> 1 img = PILImage.create(image_cat())
2 img.to_thumb(192)

NameError: name 'image_cat' is not defined**

@venomoustoad
Copy link

make sure you import * from fastbook
image_cat is a function that returns a sample cat image built into the fast.ai lib

import fastbook
fastbook.setup_book()
from fastbook import *

@PO20
Copy link

PO20 commented Jul 17, 2021

thanks, venomoustoad!

I had the same issue. This one line: from fastbook import * fixes NameError mentioned by sumitpowar above:

from fastbook import *
img1 = PILImage.create(image_cat())
img1.to_thumb(192)

The course page may benefit from this modification.

Best,
PO

@jasondeegan
Copy link

jasondeegan commented Jun 13, 2023

Still doesn't work. Neither does:
from fastai import *

Turns out that you can corrupt a Kaggle notebook with the wrong imports. Starting from scratch and this works:
! pip install -Uqq fastbook
import fastbook
fastbook.setup_book()
from fastbook import *
img = PILImage.create(image_cat())
img.to_thumb(192)

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

4 participants