Spaces:
Sleeping
Sleeping
Diego Carpintero
commited on
Commit
·
1edf77b
1
Parent(s):
61c0a18
fix predict
Browse files
app.py
CHANGED
|
@@ -6,13 +6,13 @@ description = "Built for fast.ai 'Practical Deep Learning'"
|
|
| 6 |
examples = "examples"
|
| 7 |
|
| 8 |
model = load_learner("model/model.pkl")
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def predict(img):
|
| 12 |
-
labels = model.dls.vocab
|
| 13 |
img = PILImage.create(img)
|
| 14 |
pred, pred_idx, probs = model.predict(img)
|
| 15 |
-
return dict(
|
| 16 |
|
| 17 |
|
| 18 |
demo = gr.Interface(
|
|
|
|
| 6 |
examples = "examples"
|
| 7 |
|
| 8 |
model = load_learner("model/model.pkl")
|
| 9 |
+
labels = model.dls.vocab
|
| 10 |
|
| 11 |
|
| 12 |
def predict(img):
|
|
|
|
| 13 |
img = PILImage.create(img)
|
| 14 |
pred, pred_idx, probs = model.predict(img)
|
| 15 |
+
return dict(zip(labels, map(float, probs)))
|
| 16 |
|
| 17 |
|
| 18 |
demo = gr.Interface(
|