Spaces:
Sleeping
Sleeping
File size: 572 Bytes
1578dcc 81c72ee 50a35aa 81c72ee 1578dcc 81c72ee 1578dcc 1680975 8554c02 1578dcc 7e470cf 1578dcc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from fastai.vision.all import *
import gradio as gr
import skimage
def is_cat(x): return x[0].isupper()
learn = load_learner('model.pkl')
categories = ['Dog', 'Cat']
def classify_image(img):
pred,pred_idx,probs = learn.predict(img)
return dict(zip(categories, map(float,probs)))
image = gr.components.Image(type="pil", height=224, width=224)
label = gr.components.Label(num_top_classes=3)
examples = ['cat.jpg', 'dog.jpg', 'dunno.jpg']
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
iface.launch(inline=False)
|