File size: 449 Bytes
1c10c00 c82abfa b3b092f 1c10c00 07cf1ba 8f44301 49f5c48 1c10c00 |
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('tiger-model-v3.pkl')
categories = ('Bengal', 'Siberian', 'White')
def classify_img(img):
preds, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.Image()
label = gr.Label()
examples = ['ben-tiger.jpg', 'sib-tiger.jpg']
iface = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
iface.launch()
|