File size: 491 Bytes
256f1a9
047afd8
256f1a9
047afd8
256f1a9
809ddf1
047afd8
039521e
047afd8
 
dc922c1
047afd8
039521e
047afd8
039521e
 
b732f25
039521e
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from fastai.vision.all import *

def is_cat(x): return x[0].isupper()

learn = load_learner('model.pkl')

categories = ('Grizzly', 'Black', 'Teddy')
def classify_image(img):
    pred,idx,probs = learn.predict(img)
    return dict(zip(categories, map(float,probs)))

examples = ['grizzly.jpg', 'teddy.jpg', 'dunno.jpg']

intf = gr.Interface(
    fn=classify_image,
    inputs=gr.Image(height=192, width=192),
    outputs=gr.Label(),
    examples=examples
)

intf.launch()