File size: 437 Bytes
40732fe
a86e5be
40732fe
a86e5be
40732fe
7be6084
a86e5be
 
 
 
 
 
 
 
 
 
40732fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from fastai.vision.all import *

learn = load_learner('model.pkl')

categories = ('Chihuahua', 'Muffin')

def classify(img):
    pred,_,probs = learn.predict(img)
    return dict(zip(categories, map(float,probs)))

image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ['muffin.png', 'dog.png']

iface = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples)
iface.launch()