import gradio as gr from fastai.vision.all import * learn = load_learner("bird_or_forest.pkl") classes = ["Bird", "Forest"] def classify_images(im): cat, idx, probs = learn.predict(im) return dict(zip(classes, map(float, probs))) image = gr.Image() label = gr.Label() examples = ["forest.jpg", "bird.jpg"] iface = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples) iface.launch()