Downloads · 30 days
7
1% of all-time downloads
orkungedik/hr-onboaring-doc-classifier_v1.0
hr-onboaring-doc-classifier_v1.0 is a image classification model from orkungedik. Use it when you need a label for an image. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
7
1% of all-time downloads
All-time downloads
928
Public
Parameters
85.8M
1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors343 MB · 100%
From the Hugging Face model README
HR onboarding document type classifier
from datasets import load_dataset
from transformers import ViTImageProcessor, ViTForImageClassification
import torch
# Convert the image to RGB
example = example["image"].convert('RGB')
model_name = "orkungedik/hr-onboaring-doc-classifier"
processor = ViTImageProcessor.from_pretrained(model_name)
model = ViTForImageClassification.from_pretrained(model_name)
inputs = processor(images=example, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class_idx = logits.argmax(-1).item()
label = model.config.id2label[predicted_class_idx]
print(f"Predicted class: {label}")
probs = torch.nn.functional.softmax(logits, dim=-1)
top5 = torch.topk(probs, 5)
for i in range(5):
idx = top5.indices[0][i].item()
prob = top5.values[0][i].item()
print(f"{model.config.id2label[idx]}: {prob:.4f}")