File size: 444 Bytes
2e0ede2
9679546
2e0ede2
 
f30b615
2e0ede2
 
 
9679546
 
 
 
 
 
2e0ede2
120845c
9679546
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastai.vision.all import *
import gradio as gr

learn = load_learner('model.pkl')
categories = ('Doutor Eggman', 'Sonic the Hedgehog')

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

image = gr.Image()
label = gr.Label()

examples = ['sonic.jpg', 'eggman.jpg']

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

iface.launch(inline=False)