Spaces:
Build error
Build error
Caio Braga
commited on
fix category order
Browse files
app.py
CHANGED
@@ -3,11 +3,11 @@ from fastbook import *
|
|
3 |
from fastai.vision.all import *
|
4 |
|
5 |
learn = load_learner("cats.pkl")
|
6 |
-
|
7 |
|
8 |
def classify_image(img):
|
9 |
pred, idx, probs = learn.predict(img)
|
10 |
-
return dict(zip(
|
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()
|