Call API i very slow extract data from file

I use the API to extact an XML from an image and it takes around 40s. It’s a lots because it’s about saving time to people when they enter invoices, it takes them less time. Is anyone having the same problem? is it normal?

Are you saying you’re using the API to extract plain text data from an image containing XML?

If so, why?

That seems like a huge waste of time and resources when any open source OCR project will be as good or better and effectively free.

Just use tesseract.

it is PDF of a normal invoce, it is not an invoice that contains XML. An OCR service from not AI is not as good as AI.

Thanks for the response

If you want to trade your time for money, you can try to launch multiple requests in parallel, each request extracting a different entity.

do keep in mind that Vision likes to hallucinate stuff. so OCR might be a better choice in general tbh.

Also, OCR is machine learning/AI, btw.

Is it an e-born PDF or an image PDF that is a scan of a paper invoice?

If you can provide an example PDF, then we’ll be able to see what specific challenges you might be facing.

If it’s an e-born PDF, I’d probably just use,

pdftotext invoice.pdf --layout

And pass the results into the model.

Sometimes are scan of a paper invoice and most of the cases are e-born PDF. We have hundreds of differentes invoices (for different countries). I think it is a good idea to use pdftotext and pass the results into de model.
Thanks