Spaces:
Sleeping
Sleeping
Fix for the error: AttributeError: Custom classes or functions exported with your `Learner` not available in namespace. Re-declare/import before loading: Can't get attribute 'is_cat' on <module '__main__' from '/home/user/app/app.py'>
Browse files
app.py
CHANGED
|
@@ -5,6 +5,9 @@ from fastai.vision.core import PILImage
|
|
| 5 |
from fastai.learner import load_learner
|
| 6 |
import skimage
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
learn = load_learner('model.pkl')
|
| 9 |
|
| 10 |
labels = learn.dls.vocab
|
|
|
|
| 5 |
from fastai.learner import load_learner
|
| 6 |
import skimage
|
| 7 |
|
| 8 |
+
# Define the is_cat function that was used when creating the model
|
| 9 |
+
def is_cat(x): return x[0].isupper() # This is a common implementation, adjust if yours was different
|
| 10 |
+
|
| 11 |
learn = load_learner('model.pkl')
|
| 12 |
|
| 13 |
labels = learn.dls.vocab
|