arjun-ms commited on
Commit
8b3c7f6
·
verified ·
1 Parent(s): c129b11

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
Files changed (1) hide show
  1. app.py +3 -0
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