import gradio as gr from fastai.vision.all import * learn = load_learner('export.pkl') categories = ('pristine', 'damaged') def predict(img): pred, idx, probs = learn.predict(img) return dict(zip(categories, map(float,probs))) image = gr.inputs.Image(shape=(192,192)) label = gr.outputs.Label() examples = ['street04.png', 'street06.png'] iface = gr.Interface(fn=predict, inputs=image, outputs=label, examples=examples) iface.launch(inline=False)