File size: 471 Bytes
6ef5ada
cc46e45
6ef5ada
cc46e45
6ef5ada
cc46e45
 
 
 
 
 
 
9427b4a
cc46e45
 
 
a7ba975
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from fastai.vision.all import *

learner = load_learner('model.pkl')

categories = ('Kentish plover', 'White-faced plover')

def classify_images(img):
    pred, index, probs = learner.predict(img)
    return dict(zip(categories, map(float, probs)))

image = gr.Image()
label = gr.Label()
examples = ['kentish_plover.png', 'white-faced_plover.png']

intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
intf.launch()