Spaces:
Runtime error
Runtime error
File size: 534 Bytes
f7c3bda 39d0230 8a685b2 5993bfd c187be0 f7c3bda |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from turtle import Shape
import gradio as gr
from fastai.vision.all import *
def is_cat(x):
return x[0].isupper()
learner = load_learner('model.pkl')
categories = ('cat', 'dog')
def classify_image(img):
pred, idx, probs = learner.predict(img)
probs = map(float, probs)
zipp = zip(categories, probs)
catdict = dict(zipp)
return catdict
image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label)
iface.launch(inline=False) |