File size: 429 Bytes
c211e77
1d5dd5d
 
c211e77
 
 
 
 
 
 
 
 
 
 
 
 
 
1d5dd5d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from fastai.vision.all import * 
import gradio as gr

learn = load_learner('dog-breed-model.pkl')


def classify_img(image):
    pred,idx,probs = learn.predict(image)
    return pred.split('-')[1]

image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()

examples = ['dog.jpg', 'kelpie.jpg']

intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)            
intf.launch(inline=False)