Spaces:
Sleeping
Sleeping
KathrynMercer
commited on
Upload 6 files
Browse files- 1200px-British_shorthair_cat-3113513.jpg +0 -0
- Cat Pattern Classifier App.py +18 -0
- Domestic_cat_sleeping.JPG +0 -0
- calico cat.jpg +0 -0
- export.pkl +3 -0
- requirements.txt +2 -0
1200px-British_shorthair_cat-3113513.jpg
ADDED
Cat Pattern Classifier App.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('export.pkl')
|
5 |
+
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
def predict(img):
|
8 |
+
img = PILImage.create(img)
|
9 |
+
pred,pred_idx,probs = learn.predict(img)
|
10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
gr.Interface(fn=predict,
|
13 |
+
inputs='image',
|
14 |
+
outputs='label',
|
15 |
+
title = 'Cat Coat Pattern Classifier',
|
16 |
+
description = 'A computer vision classifier that can tell you which of the major coat patterns your cat has! Extra fancy coat patterns to follow.',
|
17 |
+
examples = [r'Domestic_cat_sleeping.JPG', r'calico cat.jpg', r'1200px-British_shorthair_cat-3113513.jpg'],
|
18 |
+
interpretation='default').launch(share=True)
|
Domestic_cat_sleeping.JPG
ADDED
calico cat.jpg
ADDED
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d8472f2581c545f80056304594837ff6dd223346514afc139e62435afebe28b9
|
3 |
+
size 47000836
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai==2.7.16
|
2 |
+
gradio==4.41.0
|