Caio Braga commited on
Commit
1a047f6
·
unverified ·
1 Parent(s): 655080d

fix category order

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,11 +3,11 @@ from fastbook import *
3
  from fastai.vision.all import *
4
 
5
  learn = load_learner("cats.pkl")
6
- cat_breeds = ['persian', 'siamese', 'angora', 'sphynx']
7
 
8
  def classify_image(img):
9
  pred, idx, probs = learn.predict(img)
10
- return dict(zip(cat_breeds, map(float, probs)))
11
 
12
  image = gr.inputs.Image(shape=(192,192))
13
  label = gr.outputs.Label()
 
3
  from fastai.vision.all import *
4
 
5
  learn = load_learner("cats.pkl")
6
+ categories = learn.dls.vocab
7
 
8
  def classify_image(img):
9
  pred, idx, probs = learn.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
 
12
  image = gr.inputs.Image(shape=(192,192))
13
  label = gr.outputs.Label()