Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
def predict_image(img): | |
img_4d=img.reshape(-1,180,180,3) | |
prediction=model.predict(img_4d)[0] | |
return {class_names[i]: float(prediction[i]) for i in range(4)} | |
pipe = pipeline(task = 'image-classification', model = "google/vit-base-patch16-224") | |
image = gr.inputs.Image(shape=(180,180)) | |
label = gr.outputs.Label(num_top_classes=4) | |
gr.Interface.from_pipeline(pipe, | |
title = "Maize Leaf Disease Detection", | |
description = "Corn Leaf disease classification", | |
fn=predict_image, inputs=image, outputs=label,interpretation='default', | |
allow_flagging = "never").launch(inbrowser=True, debug='True', share='True') | |