Spaces:
Sleeping
Sleeping
File size: 510 Bytes
0f21786 61c555b 0f21786 61c555b 0f21786 |
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
# determines if it's a cat from first letter
def is_cat(x): return x[0].isupper()
# load the model
learn = load_learner('model.pkl')
categories = ('Dog', 'Cat')
def predict(img):
pred,pred_idx,probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
# show it in a gradio interface
examples = [ 'cat1.png', 'dog1.png', 'python1.png']
gr.Interface(fn=predict, inputs=gr.Image(), outputs=gr.Label(), examples=examples).launch() |