import gradio as gr from fastai.vision.all import * from fastcore.all import * learn = load_learner("c_pc_p_model.pkl") classes = ["Cake", "Pancake", "Pie"] def classify_image(img): pred, idx, probs = learn.predict(img) return dict(zip(classes, map(float, probs))) image = gr.Image() label = gr.Label() examples = ["cake.jpg", "pancake.jpg", "pancakepie.jpg", "pie.jpg", "piecake.jpg"] intrf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) intrf.launch(inline=False)