Spaces:
Runtime error
Runtime error
kvapiltomas
commited on
Commit
•
3021290
1
Parent(s):
094721d
deploy to huggingface spaces
Browse files- Basset-Hound-standing-in-the-garden.jpg +0 -0
- app.py +21 -0
- model_new.plk +3 -0
- requirements.txt +1 -0
Basset-Hound-standing-in-the-garden.jpg
ADDED
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
pat = r'^(.*)_\d+.jpg'
|
5 |
+
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
|
8 |
+
def classify_image(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred, idx, probs = learn.predict(img)
|
11 |
+
return {labels[i] : float(probs[i]) for i in range(len(labels))}
|
12 |
+
#return dict(zip(labels, map(float,probs)))
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(512,512))
|
15 |
+
label = gr.outputs.Label(num_top_classes=3)
|
16 |
+
examples = ['Basset-Hound-standing-in-the-garden.jpg']
|
17 |
+
title = "Cat&Dog Breed Classifier"
|
18 |
+
description = "A cat and dog breed classifier trained on the Oxford Pets dataset."
|
19 |
+
|
20 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, title=title, description = description, enable_queue=True)
|
21 |
+
intf.launch(inline=False, share=True)
|
model_new.plk
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d9518c002caa2103748471b9345189aec0287b6e11f94857d7c6d457235256a5
|
3 |
+
size 47145695
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|