File size: 354 Bytes
21ab78a
2fd062e
21ab78a
2fd062e
21ab78a
2fd062e
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from fastai.vision.all import *

learner = load_learner('model.pkl')

def classify_image(img):
    pred, idx, probs =learner.predict(img)
    return dict(zip(learner.dls.vocab, map(float, probs)))

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

iface = gr.Interface(fn=classify_image, inputs=image, outputs=label)
iface.launch(inline=False)