bearSafety / app.py
Vinaya's picture
script edits
2784b37
raw
history blame contribute delete
509 Bytes
from fastai.vision.all import *
import gradio as gr
learn_inf = load_learner("export.pkl")
categories = ('black', 'gizzly', 'teddy')
def classify_image(img):
pred, pred_index, probs = learn_inf.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ['ted.jpeg', 'bear.webp', 'aBear.jpeg']
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
interface.launch(inline = False)