bears / app.py
akgeni's picture
resoved bugs
49fc6b3
import gradio as gr
from fastai.vision.all import *
learner = load_learner("export.pkl")
categories = ['black bear', 'grizzly bear', 'teddy bear']
def classify_image(image):
pred, idx, prob = learner.predict(image)
return dict(zip(categories, map(float, prob)))
image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
examples = ['test_image.jpg']
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch()