bears / app.py
akgeni's picture
app updated
6938305
raw
history blame
No virus
471 Bytes
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(im)
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()