Downloads · 30 days
19
13% of all-time downloads
orkungedik/hr-onboaring-doc-classifier_v1.1
hr-onboaring-doc-classifier_v1.1 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
19
13% of all-time downloads
All-time downloads
147
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_v1.1"
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}")
ID2LABEL = { 0: '{"document_type":"adres_belgesi"}', 1: '{"document_type":"banka_belgesi"}', 2: '{"document_type":"askerlik_belgesi"}', 3: '{"document_type":"mezuniyet_belgesi"}', 4: '{"document_type":"nüfus_belgesi"}', 5: '{"document_type":"diğer"}', }