SudeepM27's picture
Update README.md
154b840 verified
metadata
library_name: transformers
tags: []

Model Card for Model ID

MobileVITV2 based Image Classification model to classify apple leaf diseases

Model Details

Model Description

  • Developed by: Sudeep Mungara

Uses

To classify if the apple leaf is healthy, rust, scab or has multiple diseases

How to Get Started with the Model


from PIL import Image
import torch
from transformers import AutoImageProcessor, AutoModelForImageClassification

processor = AutoImageProcessor.from_pretrained("SudeepM27/apple-leaf-disease-detection")
model = AutoModelForImageClassification.from_pretrained("SudeepM27/apple-leaf-disease-detection")

model.eval()
image_path = "path to image"  # Replace with your test image path
image = Image.open(image_path)
inputs = processor(images=image, return_tensors="pt")

# Perform inference
with torch.no_grad():
    outputs = model(**inputs)

# Get the predicted class
logits = outputs.logits
predicted_class_idx = logits.argmax(-1).item()
predicted_label = model.config.id2label[predicted_class_idx]

print(f"Predicted class index: {predicted_class_idx}")
print(f"Predicted label: {predicted_label}")
-->