Spaces:
Sleeping
Sleeping
File size: 511 Bytes
9528e2d 1a1e095 9528e2d 1a1e095 9528e2d 00b88ad 4ea0ed0 9528e2d 16a84ef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastai.vision.all import *
import gradio as gr
categories = 'Giant panda', 'Red panda'
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
learn = load_learner('model.pkl')
image = gr.Image(height=192, width=192)
label = gr.Label()
examples = ['giant_0.jpg', 'red_0.jpg', 'giant_1.jpg', 'red_1.jpg']
interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
interface.launch(inline=False, share=True) |