manan05's picture
testing
5038e93
__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)