Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
import gradio as gr | |
learn = load_learner('model.pkl') | |
categories = ('!bat', 'bat') | |
def classify_bat(img): | |
label,_,probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
image = gr.inputs.Image(shape=(200, 200)) | |
label = gr.outputs.Label() | |
examples = ['bat1.png', 'bat2.png', 'not_bat.png'] | |
iface = gr.Interface(fn=classify_bat, inputs=image, outputs=label, examples=examples) | |
iface.launch() |