Run this model with HF Jobs

Run fedihch/InvoiceReceiptClassifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/fedihch/InvoiceReceiptClassifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/fedihch/InvoiceReceiptClassifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

InvoiceReceiptClassifier is a fine-tuned LayoutLMv2 model that classifies a document to an invoice or receipt.

Quick start: using the raw model

from transformers import (
    AutoModelForSequenceClassification,
    AutoProcessor,
)
from PIL import Image
from urllib.request import urlopen


model = AutoModelForSequenceClassification.from_pretrained("fedihch/InvoiceReceiptClassifier")
processor = AutoProcessor.from_pretrained("fedihch/InvoiceReceiptClassifier")

input_img_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/ReceiptSwiss.jpg/1024px-ReceiptSwiss.jpg"
with urlopen(input_img_url) as testImage:
    input_img = Image.open(testImage).convert("RGB")
    
encoded_inputs = processor(input_img, padding="max_length", return_tensors="pt")
outputs = model(**encoded_inputs)
logits = outputs.logits
predicted_class_idx = logits.argmax(-1).item()
id2label = {0: "invoice", 1: "receipt"}
print(id2label[predicted_class_idx])
Downloads last month
30
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using fedihch/InvoiceReceiptClassifier 1