import gradio as gr from fastai.vision.all import * learn=load_learner("model.pkl") def classify_images(im): pred,idx,probs=learn.predict(im) if pred=='Healthy': s='Your plant is '+pred else: s='Your plant has '+pred return s img=gr.Image(shape=(300,200),image_mode="RGB") label=gr.Label() examples=["healthy1.jpeg","mosaic.jpeg","redrot.jpeg"] intf=gr.Interface(title="Sugarcane leaves Disease Recognition App",description="You can choose an example or choose picture of your plant.",fn=classify_images,inputs=img,outputs=label,examples=examples) intf.launch(inline=False)