Image Classification
Transformers
PyTorch
Spanish
English
multilingual
layoutlmv3
feature-extraction
Run this model with HF Jobs
Run fedihch/InvoiceReceiptClassifier_LayoutLMv3 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_LayoutLMv3. 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_LayoutLMv3 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.
Instructions to use fedihch/InvoiceReceiptClassifier_LayoutLMv3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fedihch/InvoiceReceiptClassifier_LayoutLMv3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="fedihch/InvoiceReceiptClassifier_LayoutLMv3") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("fedihch/InvoiceReceiptClassifier_LayoutLMv3") model = AutoModel.from_pretrained("fedihch/InvoiceReceiptClassifier_LayoutLMv3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from fedihch/InvoiceReceiptClassifier_LayoutLMv3: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/fedihch/InvoiceReceiptClassifier_LayoutLMv3/resolve/main/README.md
- Command line
-
hf download hf://fedihch/InvoiceReceiptClassifier_LayoutLMv3/README.md
-
curl -L -o README.md https://huggingface.co/fedihch/InvoiceReceiptClassifier_LayoutLMv3/resolve/main/README.md
1.38 kB
metadata
language:
- es
- en
- multilingual
license: other
tags:
- image-classification
pipeline_tag: image-classification
widget:
- src: >-
https://upserve.com/media/sites/2/Bill-from-Mezcalero-in-Washington-D.C.-photo-by-Alfredo-Solis-1-e1507226752437.jpg
example_title: receipt
- src: https://templates.invoicehome.com/invoice-template-us-neat-750px.png
example_title: invoice
InvoiceReceiptClassifier_LayoutLMv3 is a fine-tuned LayoutLMv3 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_LayoutLMv3")
processor = AutoProcessor.from_pretrained("fedihch/InvoiceReceiptClassifier_LayoutLMv3")
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])