Spaces:
Sleeping
Sleeping
eivindthrondsen
commited on
Commit
•
a3ec7f4
1
Parent(s):
b01672f
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,12 @@ learn = load_learner('model.pkl')
|
|
6 |
|
7 |
labels = learn.dls.vocab
|
8 |
def predict(img):
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
|
13 |
-
def is_cat(x):
|
|
|
14 |
|
15 |
title = "Pet Breed Classifier"
|
16 |
description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|
|
|
6 |
|
7 |
labels = learn.dls.vocab
|
8 |
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
|
13 |
+
def is_cat(x):
|
14 |
+
return x[0].isupper()
|
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."
|