Spaces:
Sleeping
Sleeping
mariia.mansurova
commited on
Commit
·
2c94878
1
Parent(s):
3cd394d
First version of Cuttest Dogs App
Browse files- app.py +24 -4
- corgi.jpg +0 -0
- cuttest_dogs_model.pkl +3 -0
- husky.jpg +0 -0
- pomeranian.jpg +0 -0
- retriever.jpg +0 -0
- samoyed.jpg +0 -0
app.py
CHANGED
@@ -1,7 +1,27 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
|
5 |
+
learn = load_learner('cuttest_dogs_model.pkl')
|
|
|
6 |
|
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 |
+
title = "The Cuttest Dogs Classifier 🐶🐕🦮🐕🦺"
|
14 |
+
description = "Classifier trainded on images of huskies, retrievers, pomeranians, corgis and samoyeds. Created as a demo for Deep Learning app using HuggingFace Spaces & Gradio."
|
15 |
+
examples = ['husky.png', 'retriever.png', 'corgi.png', 'pomeranian.png', 'samoyed.png']
|
16 |
+
interpretation='default'
|
17 |
+
enable_queue=True
|
18 |
+
|
19 |
+
gr.Interface(
|
20 |
+
fn=predict,
|
21 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
22 |
+
outputs=gr.outputs.Label(num_top_classes=5),
|
23 |
+
title=title,
|
24 |
+
description=description,
|
25 |
+
examples=examples,
|
26 |
+
interpretation=interpretation,
|
27 |
+
enable_queue=enable_queue).launch()
|
corgi.jpg
ADDED
cuttest_dogs_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b6f8745894949c47064c0448fffb6cc22e732d4ab6ddbe68e08a396498e212e4
|
3 |
+
size 47032058
|
husky.jpg
ADDED
pomeranian.jpg
ADDED
retriever.jpg
ADDED
samoyed.jpg
ADDED