jkyamog's picture
use model bear
883fde2
Raw
History Blame Contribute Delete
475 Bytes
from fastai.vision.all import *
import gradio as gr
learner = load_learner('model_bear.pkl')
categories = ['black','grizzly','teddy']
def classify_image(image):
pred, idx, prob = learner.predict(image)
return dict(zip(categories, map(float, prob)))
image = gr.Image(type="pil")
label = gr.Label()
examples = ['black.jpg', 'grizzly.jpg', 'teddy.jpg']
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch(inline=False)