Spaces:
Runtime error
Runtime error
File size: 433 Bytes
2049057 e6e7aa4 2049057 96bebdc 2049057 da62858 2049057 96bebdc 2049057 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
image = gr.Image(type='pil', height=192, width=192)
label = gr.Label()
categories = ('Black Bear', 'Grizzly Bear', 'Teddy Bear')
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
intf.launch(inline=False)
|