Spaces:
Sleeping
Sleeping
xerxes666666
commited on
Commit
·
456ae73
1
Parent(s):
05a55d1
let's deploy to huggingface spaces
Browse files- app.py +18 -0
- cat.jpg.webp +0 -0
- export.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('export.pkl')
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
def predict(img):
|
8 |
+
img = PILImage.create(img)
|
9 |
+
pred, idx, probs = learn.predict(img)
|
10 |
+
return{labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
title = "Breed Classifier"
|
13 |
+
description = "A animal/pet Breed Classifier"
|
14 |
+
examples = ['cat.jpg.webp']
|
15 |
+
interpretation = 'default'
|
16 |
+
enable_queue = True
|
17 |
+
|
18 |
+
gr.Interface(fn = predict, inputs = gr.Image(), outputs = gr.Label(num_top_classes = 3), title = title, description = description , examples = examples).launch(share=True)
|
cat.jpg.webp
ADDED
![]() |
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f262feb5ed7f76660ee523d5632b4112997242ddc56ae252793532a6d2d7333d
|
3 |
+
size 103057580
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|