File size: 561 Bytes
358e578 3e2bc02 fef88a4 358e578 3e2bc02 358e578 3e2bc02 358e578 3e2bc02 358e578 3e2bc02 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
from fastai.vision.all import load_learner, PILImage
learn = load_learner('model.pkl')
def classify_image(image):
pred, _, probs = learn.predict(image)
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
interface = gr.Interface(
fn=classify_image,
inputs=gr.Image(type='pil'), # Updated to new API
outputs=gr.Label(num_top_classes=3), # Updated to new API
title="Potato Plant Disease Classifier",
description="Potato leaf:"
)
if __name__ == "__main__":
interface.launch(share=True)
|