Spaces:
Sleeping
Sleeping
Commit
·
9782237
1
Parent(s):
eee9284
Updated .gitattributes so git lfs will track .pkl files
Browse files- .DS_Store +0 -0
- .vscode/settings.json +6 -0
- app.py +18 -4
- model.pkl +3 -0
- puppy.jpeg +0 -0
- requirements.txt +2 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
.vscode/settings.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"[python]": {
|
3 |
+
"editor.defaultFormatter": "ms-python.black-formatter"
|
4 |
+
},
|
5 |
+
"python.formatting.provider": "none"
|
6 |
+
}
|
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
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('export.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 |
+
|
14 |
+
title = "Dog vs Cat Classifier"
|
15 |
+
description = "A Dog vs Cat classifier trained on the Oxford Pets dataset with fastai."
|
16 |
+
article="<p style='text-align: center'><a href='https://sirgil.org' target='_blank'>Sirgil Home</a></p>"
|
17 |
+
examples = ['puppy.jpeg']
|
18 |
+
interpretation='default'
|
19 |
+
enable_queue=True
|
20 |
+
|
21 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b2e44ac43fb51e91529cd05fa3ca782fdf14edc05d98a5ef583dc4c946f00624
|
3 |
+
size 47061329
|
puppy.jpeg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|