Spaces:
Sleeping
Sleeping
File size: 555 Bytes
2c08f94 5038e93 bd7f417 2c08f94 bd7f417 2c08f94 bd7f417 2c08f94 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
__all__ = ['learnafter', 'classify_images', 'categories', 'image', 'label', 'examples', 'iface']
#testing
import gradio as gr
from fastai.vision.all import *
learnafter = load_learner('export.pkl')
categories = ('cheetah','lion','tiger')
def classify_images(img):
pred, idx, probs = learnafter.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.inputs.Image(shape=(224, 224))
label = gr.outputs.Label()
examples = ['lion.jpg']
iface = gr.Interface(fn=classify_images, inputs=image, outputs=label)
iface.launch(inline=False) |