import gradio as gr from fastai.vision.all import * from glob import glob learn_inf = load_learner('model.pkl') categories = ("Decease", "Healthy") def classify(img): pred, pred_idx, probs = learn_inf.predict(img) return dict(zip(categories, map(float, probs))) image = gr.inputs.Image(shape=(224, 224)) label = gr.outputs.Label() examples = glob("images/*.jpg") title = "Strawberry Leaves Decease Classifier" description = "This classifier was trained on the 'Image Dataset for Tipburn Disorder Detection in Strawberry Leaves' and it is designed to help you detect weather straberry leaves are infected or not." interpretation='default' iface = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples, title=title, description=description, interpretation=interpretation) iface.launch(enable_queue=True)