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)