Spaces:
Runtime error
Runtime error
rhogard
commited on
Commit
•
c5bc181
1
Parent(s):
ceec495
add project files
Browse files- Beagle.jpg +0 -0
- Bulldog.jpg +0 -0
- Daschund.jpg +0 -0
- French Bulldog.jpg +0 -0
- app.py +23 -0
- export.pkl +3 -0
Beagle.jpg
ADDED
Bulldog.jpg
ADDED
Daschund.jpg
ADDED
French Bulldog.jpg
ADDED
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__all__ = ['learn', 'clasify_image', 'categories', 'image', 'label', 'examples', 'intf']
|
2 |
+
|
3 |
+
from fastai.vision.all import *
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
# Cell
|
7 |
+
learn = load_learner('export.pkl')
|
8 |
+
|
9 |
+
# Cell
|
10 |
+
categories = ('Beagle', 'Bulldog', 'Dachshund', 'French Bulldog', 'German Shepherd', 'German Shorthaired Pointer', 'Golden Retriever', 'Labrador Retriever', 'Poodle', 'Rottweiler')
|
11 |
+
|
12 |
+
# Cell
|
13 |
+
def classify_image(img):
|
14 |
+
pred,idx,probs = learn.predict(img)
|
15 |
+
return dict(zip(categories, map(float,probs)))
|
16 |
+
|
17 |
+
# Cell
|
18 |
+
image = gr.inputs.Image(shape=(192,192))
|
19 |
+
label = gr.outputs.Label()
|
20 |
+
examples = ['Beagle.jpg', 'Bulldog.jpg', 'Dachshund.jpg', 'French Bulldog.jpg']
|
21 |
+
|
22 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outpus=label, examples=examples)
|
23 |
+
intf.launch(inline=False)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:11d9c1082f22492f5d81fb795c2bd9f6b5bc2bfa63413856ec94b30b13e5797f
|
3 |
+
size 46985697
|