Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,12 +8,10 @@ learn = load_learner('snackdetector.pkl')
|
|
8 |
labels = learn.dls.vocab
|
9 |
|
10 |
def predict(img):
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
pred,pred_idx,probs = learn.predict(img)
|
15 |
-
|
16 |
-
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
17 |
|
18 |
title = "Dutch Snack Detector"
|
19 |
|
|
|
8 |
labels = learn.dls.vocab
|
9 |
|
10 |
def predict(img):
|
11 |
+
img = PILImage.create(img)
|
12 |
+
pred,pred_idx,probs = learn.predict(img)
|
13 |
|
14 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
|
|
|
|
|
|
|
|
15 |
|
16 |
title = "Dutch Snack Detector"
|
17 |
|