Spaces:
Runtime error
Runtime error
File size: 484 Bytes
eee52e4 341448c eee52e4 a171dc3 39f8262 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model_beeOrWasp.pkl')
labels = ('Bee', 'Wasp')
def predict(img):
pred, pred_idx, prob = learn.predict(img)
return dict(zip(labels, map(float, prob)))
title="Bee or wasp classifier"
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = ['bee.jpg', 'wasp.jpg']
intf = gr.Interface(fn=predict,inputs=image,outputs=label, examples=examples, title=title)
intf.launch(inline=False)
|