Downloads · 30 days
8
9% of all-time downloads
amezghani5/vit
vit is a image classification model from amezghani5. Use it when you need a label for an image. The card lists the license as mit.
Fine-tuned Vision Transformer for medical image classification.
Downloads · 30 days
8
9% of all-time downloads
All-time downloads
93
Public
Parameters
85.8M
343 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors343 MB · 100%
From the Hugging Face model README
Fine-tuned Vision Transformer for medical image classification.
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
import torch
model_name = "amezghani5/vit"
processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForImageClassification.from_pretrained(
"amezghani5/vit",
cache_dir="./models"
)
image = Image.open("test.png")
inputs = processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
predicted_class = outputs.logits.argmax(-1)
print(predicted_class)