ccdle12's picture
remove unused examples
25e8796
raw
history blame contribute delete
433 Bytes
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
image = gr.Image(type='pil', height=192, width=192)
label = gr.Label()
categories = ('Black Bear', 'Grizzly Bear', 'Teddy Bear')
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)