'Let's try this'
Browse files- LeopardCheetah.pkl +3 -0
- app.py +27 -0
LeopardCheetah.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:20489459d404e8699b79d9bc9f2b60fd77fa6413f1d583ed26b79084dc33d748
|
3 |
+
size 46994401
|
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#|export
|
2 |
+
|
3 |
+
from fastcore.all import *
|
4 |
+
from fastai.vision.all import *
|
5 |
+
from fastbook import load_learner
|
6 |
+
import gradio as gr
|
7 |
+
|
8 |
+
inf = load_learner('LeopardCheetah.pkl')
|
9 |
+
|
10 |
+
categories = ('Cheetah','Images','Leopard')
|
11 |
+
|
12 |
+
def classify_img(img):
|
13 |
+
pred, idx, probs = inf.predict(img)
|
14 |
+
return dict(zip(categories,map(float,probs)))
|
15 |
+
|
16 |
+
#|export
|
17 |
+
|
18 |
+
#This creates the gradio interface
|
19 |
+
|
20 |
+
image = gr.Image(shape=(192,192))
|
21 |
+
label = gr.outputs.Label()
|
22 |
+
|
23 |
+
examples = ['cheetah.jpg','leopard.jpg','img.jpg']
|
24 |
+
|
25 |
+
intf = gr.Interface(fn = classify_img, inputs=image,outputs=label,examples = examples)
|
26 |
+
|
27 |
+
intf.launch(inline=False)
|