Spaces:
Build error
Build error
File size: 586 Bytes
1288394 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | from fastai.vision.all import *
import gradio as gr
learn = load_learner('model.pkl')
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred,pred_idx,probs = learn.predict(img)
return dict(zip(labels, map(float, probs)))
title = "Lion Tiger Classifier"
examples = ['lion.jpg', 'tiger.jpg', 'tigon.jpg', 'liger.jpg']
demo = gr.Interface(fn=predict,
inputs=gr.Image('lion.jpg'),
outputs=gr.Label(),
title=title,
examples=examples)
demo.launch(inline=False, show_error=True)
|