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.Inputs.Image(shape=(192, 192)) label = gr.Outputs.Label() examples = ["forest.jpg", "bird.jpg"] iface = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples) iface.launch()