1
$\begingroup$

So I have lots of data (pdfs) that I want to train an AI model to extract info from. All of them are a little different but have the same key data points. Is it possible to train an AI on the pdfs I have and see if it would be able to recognize other pdfs I throw at it?

Does anyone know the best way to go about this? Sorry if this is a noob question wasn't sure where to post. Thanks in advance.

$\endgroup$

1 Answer 1

0
$\begingroup$

There are a few models on Hugging Face you might want to look at. TrOCR is a transformer-based OCR model. If you know Python, you can experiment with this and see if the current generation of technology produces better OCR results than older AI solutions like Tesseract.

However, it sounds like your problem isn't OCR, it's Document Question Answering. Hugging Face have a bunch of different models for this, and one of the most downloaded is LayoutLM. The "getting started" Python code demonstrates how you could use this model to ask questions expressed in natural language about a document provided in image format:

from transformers import pipeline

nlp = pipeline(
    "document-question-answering",
    model="impira/layoutlm-document-qa",
)

nlp(
    "https://templates.invoicehome.com/invoice-template-us-neat-750px.png",
    "What is the invoice number?"
)
# {'score': 0.9943977, 'answer': 'us-001', 'start': 15, 'end': 15}

nlp(
    "https://miro.medium.com/max/787/1*iECQRIiOGTmEFLdWkVIH2g.jpeg",
    "What is the purchase amount?"
)
# {'score': 0.9912159, 'answer': '$1,000,000,000', 'start': 97, 'end': 97}

Searching for tutorials on document question answering, and looking at the other tasks and models in the Natural Language Processing category on Hugging Face, will help you to explore these ideas further.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .