bearclassifier / app.py
George Sergia
Add examples and udpate app file
fc71058
raw
history blame
528 Bytes
from fastai.vision.all import *
import gradio as gr
learner = load_learner("bears.pkl")
categories = ("grizzly", "black", "white", "brown", "teddy")
def classify_bear(img):
pred,idx,probs=learner.predict(img)
return dict(zip(categories, map(float,probs)))
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples=["grizzly.jpg", "brown.jpg", "white.jpg", "black.jpg", "teddy.jpg"]
iface = gr.Interface(fn=classify_bear, inputs=image, outputs=label, examples=examples)
iface.launch(inline=False)