from fastai.vision.all import * import gradio as gr import pathlib learn = load_learner('model.pkl') categories = ('Empty','Healthy', 'Wilted') def classify_img(img): pred, idx, probs = learn.predict(img) return dict(zip(categories, map(float,probs))) image = gr.Image(shape=(192,192)) label = gr.Label() intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples= ['healthy_hydro_kale.jpg', 'wilted_plant.jpg', 'empty_trays.jpg']) intf.launch(inline=False)