Spaces:
Runtime error
Runtime error
File size: 496 Bytes
1ef7059 0399aa2 1ef7059 0399aa2 1ef7059 0399aa2 1ef7059 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner("export.pkl")
examples = ['jokicpassing.jpg', 'modric.jpg', 'tennis.jpg']
categories = ('basketball', 'soccer', 'tennis')
def classify_image(img):
pred,idx,prob = learn.predict(img)
return dict(zip(categories, map(float, prob)))
images = gr.Image(height = 224, width=224)
labels = gr.Label()
intf = gr.Interface(fn = classify_image, inputs=images, outputs=labels, examples=examples)
intf.launch(inline = False) |