File size: 391 Bytes
f1d1c42
51fdae5
 
9ae32a6
f1d1c42
51fdae5
f1d1c42
1215df2
51fdae5
 
1215df2
51fdae5
1215df2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr
from fastai.vision.all import *

examples = ['bear.jpeg']

learn = load_learner('./model.pkl')

def classify_image(img):
  pred, pred_idx,probs = learn.predict(img)
  return {k: '{:.04f}'.format(v) for k, v in zip(learn.dls.vocab, map(float, probs))}

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