Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,8 @@ learner = from_pretrained_fastai(repo_id)
|
|
22 |
|
23 |
def inference(image):
|
24 |
label_predict,_,probs = learner.predict(image)
|
25 |
-
|
|
|
26 |
|
27 |
gr.Interface(
|
28 |
fn=inference,
|
@@ -30,7 +31,7 @@ gr.Interface(
|
|
30 |
description = "Predict which type of rice belong to Arborio, Basmati, Ipsala, Jasmine, Karacadag",
|
31 |
inputs="image",
|
32 |
examples=examples,
|
33 |
-
|
34 |
cache_examples=False,
|
35 |
article = "Author: <a href=\"https://www.linkedin.com/in/vumichien/\">Vu Minh Chien</a>",
|
36 |
).launch(debug=True, enable_queue=True)
|
|
|
22 |
|
23 |
def inference(image):
|
24 |
label_predict,_,probs = learner.predict(image)
|
25 |
+
labels_probs = {labels[i]: float(probs[i]) for i, _ in enumerate(labels)}
|
26 |
+
return labels_probs
|
27 |
|
28 |
gr.Interface(
|
29 |
fn=inference,
|
|
|
31 |
description = "Predict which type of rice belong to Arborio, Basmati, Ipsala, Jasmine, Karacadag",
|
32 |
inputs="image",
|
33 |
examples=examples,
|
34 |
+
output=gr.outputs.Label(num_top_classes=5, label='Prediction'),
|
35 |
cache_examples=False,
|
36 |
article = "Author: <a href=\"https://www.linkedin.com/in/vumichien/\">Vu Minh Chien</a>",
|
37 |
).launch(debug=True, enable_queue=True)
|