Spaces:
Sleeping
Sleeping
Commit ·
dfbc18c
1
Parent(s): 06dbd7c
update dogs model
Browse files- app.py +11 -3
- dogs.pkl +3 -0
- golden_retriver.jpg +0 -0
- husky.jpg +0 -0
- requriements.txt +3 -0
- samoyed.jpg +0 -0
app.py
CHANGED
|
@@ -4,8 +4,16 @@ from fastai.vision.all import *
|
|
| 4 |
def greet(name):
|
| 5 |
return f"Hello {name} !!"
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
iface.launch()
|
|
|
|
| 4 |
def greet(name):
|
| 5 |
return f"Hello {name} !!"
|
| 6 |
|
| 7 |
+
def classify_image(img):
|
| 8 |
+
pred, idx, probs = learn.predict(img)
|
| 9 |
+
return dict(zip(categories, map(float, probs)))
|
| 10 |
|
| 11 |
+
learn = load_learner('dogs.pkl')
|
| 12 |
+
categories = learn.dls.vocab
|
| 13 |
+
|
| 14 |
+
image = gr.inputs.Image(shape = (192, 192))
|
| 15 |
+
label = gr.outputs.Label()
|
| 16 |
+
examples = ['golden_retriver.jpg', 'husky.jpg', 'samoyed.jpg']
|
| 17 |
+
|
| 18 |
+
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples = examples)
|
| 19 |
iface.launch()
|
dogs.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75855d20cc308272526932e4995757d7efcbdfa6fea44b818d13b65f61fc2737
|
| 3 |
+
size 355582638
|
golden_retriver.jpg
ADDED
|
husky.jpg
ADDED
|
requriements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch <1.12
|
| 2 |
+
fastai>2.6.1
|
| 3 |
+
timm
|
samoyed.jpg
ADDED
|