Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,13 @@ repo_id = "MasleK/snails_snakes_slugs"
|
|
8 |
|
9 |
learner = from_pretrained_fastai(repo_id)
|
10 |
|
|
|
11 |
|
12 |
def predict(image):
|
13 |
-
label, index,
|
14 |
|
15 |
-
return
|
|
|
16 |
title = "Snail, snake, slug Classifier"
|
17 |
description = f"""<h1> Slug, snake or snail<h1>
|
18 |
<p>A classifier trained on about 300 images. Created as a demo for Gradio and HuggingFace Spaces."""
|
|
|
8 |
|
9 |
learner = from_pretrained_fastai(repo_id)
|
10 |
|
11 |
+
categories = learner.learn.dls.vocab
|
12 |
|
13 |
def predict(image):
|
14 |
+
label, index, probs = learner.predict(image)
|
15 |
|
16 |
+
return dict(zip(categories, map(float,probs)))
|
17 |
+
|
18 |
title = "Snail, snake, slug Classifier"
|
19 |
description = f"""<h1> Slug, snake or snail<h1>
|
20 |
<p>A classifier trained on about 300 images. Created as a demo for Gradio and HuggingFace Spaces."""
|