Spaces:
Sleeping
Sleeping
added example images
Browse files- Boxer.jpg +0 -0
- Keeshond.jpg +0 -0
- Siamese.jpg +0 -0
- app.py +18 -0
- basset_hound2.jpg +0 -0
- cocker_spaniel.jpg +0 -0
- requirements.txt +5 -0
Boxer.jpg
ADDED
![]() |
Keeshond.jpg
ADDED
![]() |
Siamese.jpg
ADDED
![]() |
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner('petClassifierModel.pkl')
|
5 |
+
|
6 |
+
|
7 |
+
categories = learn.dls.vocab
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred, idx, probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float, probs)))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(192,192))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = ['basset_hound2.jpg','Boxer.jpg','cocker_spaniel.jpg','Keeshond.jpg','Siamese.jpg', 'sphynx.jpg', 'St_Bernard_Dog.jpg']
|
16 |
+
|
17 |
+
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
18 |
+
iface.launch()
|
basset_hound2.jpg
ADDED
![]() |
cocker_spaniel.jpg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pytorch
|
2 |
+
fastai
|
3 |
+
gradio
|
4 |
+
pandas
|
5 |
+
numpy
|