Spaces:
Sleeping
Sleeping
sachin
commited on
Commit
•
a68255f
1
Parent(s):
3cc5247
try cat"
Browse files- app.py +19 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner(better_cat.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 = "Know your cat"
|
14 |
+
description = "Cat Breed detection is hard. Use pic with cat only"
|
15 |
+
examples = ['cat.png', 'Lasse Cat.png', 'Pumpking.png']
|
16 |
+
interpretation='default'
|
17 |
+
enable_queue=True
|
18 |
+
|
19 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,examples=examples,interpretation=interpretation).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|