Spaces:
Build error
Build error
File size: 456 Bytes
4ef584e e8ea125 4ef584e e8ea125 4ef584e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from fastai.vision.all import *
import gradio as gr
learn = load_learner('model.pkl')
categories = ['bird', 'cat', 'dog', 'forest']
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.Image(type="pil")
label = gr.Label()
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=['bird.jpg', 'cat.jpg', 'dog.jpg', 'forest.jpg'])
interface.launch()
|