Spaces:
Sleeping
Sleeping
neilkazimierzsheridan
commited on
Commit
·
6665a29
1
Parent(s):
2d6cd88
alter code
Browse files
app.py
CHANGED
@@ -3,16 +3,17 @@ import skimage
|
|
3 |
|
4 |
import gradio as gr
|
5 |
|
|
|
6 |
labels = learn.dls.vocab
|
7 |
def predict(img):
|
8 |
img = PILImage.create(img)
|
9 |
pred,pred_idx,probs = learn.predict(img)
|
10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
|
12 |
-
learn = load_learner('export_pets.pkl') #this is a kinda dog detector it seems
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
|
6 |
+
learn = load_learner('export_pets.pkl') #this is a kinda dog detector it seems
|
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 |
|
14 |
+
|
15 |
+
gr.Interface(fn=predict,
|
16 |
+
title="Pet Breed Classifier",
|
17 |
+
description="Pet breed classifier using Oxford Pets Database. Test for Gradio and HuggingFace",
|
18 |
+
inputs=gr.Image(width=512, height=512), #this is the proper syntax for images not the (shape=(xxx,xxx))
|
19 |
+
outputs=gr.Label(num_top_classes=3)).launch(share=True)
|