funkstop
commited on
Commit
·
ef7e081
1
Parent(s):
37073c0
added categories
Browse files
app.py
CHANGED
@@ -7,11 +7,13 @@ def is_cat(x):
|
|
7 |
|
8 |
learn = load_learner('model.pkl')
|
9 |
|
|
|
|
|
10 |
labels = learn.dls.vocab
|
11 |
def predict(img):
|
12 |
img = PILImage.create(img)
|
13 |
pred,pred_idx,probs = learn.predict(img)
|
14 |
-
return
|
15 |
|
16 |
title = "Pet Breed Classifier"
|
17 |
description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|
|
|
7 |
|
8 |
learn = load_learner('model.pkl')
|
9 |
|
10 |
+
categories = ('Dog','Cat')
|
11 |
+
|
12 |
labels = learn.dls.vocab
|
13 |
def predict(img):
|
14 |
img = PILImage.create(img)
|
15 |
pred,pred_idx,probs = learn.predict(img)
|
16 |
+
return dict(zip(categories, map(float,probs)))
|
17 |
|
18 |
title = "Pet Breed Classifier"
|
19 |
description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|