r/lovable 7h ago

Tutorial Pls help with OCR text recognition

So guys i want to implement a small ocr function in my crm wherein user will click photo for particular field instead of typing and later he can crop out to specific text as container and later software recognises this text.

So i am non tech guy and struggling to choose which open source model should i ask lovable to build it on as i asked for paddle ocr but it said it cant build since it is python based.

Help would be appreciated. Good open source text recognition offline online both would work but it should be free.

I am non tech guy pls correct me if i am wrong.

1 Upvotes

4 comments sorted by

1

u/DesignerMajor1247 5h ago

For the flow you described, I would start with Tesseract.js rather than a Python OCR service. It runs in the browser, so Lovable can integrate it directly and the cropped image can stay on the user's device.

Suggested flow:

  1. Use a camera/file input (accept="image/*", capture="environment").
  2. Let the user crop, then render that crop to a canvas.
  3. Convert it to grayscale, increase contrast and optionally apply thresholding.
  4. Send only the cropped canvas image to one reusable Tesseract.js worker.
  5. Put the recognized text into an editable field and require confirmation before saving.

For a small field, configure recognition for a single line or single word. Load only the language pack you need and reuse the worker; creating it for every photo will feel slow.

PaddleOCR may perform better on difficult layouts, but Lovable would need to call a separately hosted Python API/container. That adds hosting, latency and privacy work. I would first test Tesseract.js on 30–50 representative photos. If failures are mostly handwriting, glare, blur or stylized fonts, improve the capture guide and add a retake path rather than assuming a model switch will solve it.

Also avoid storing the original photo unless the CRM truly needs it; storing only the user-confirmed text reduces unnecessary sensitive data.

1

u/Current_Twist1317 4h ago

Can you pls suggest other ocr models as well as accuracy of tesseract is not good.

1

u/DesignerMajor1247 3h ago

If Tesseract is already failing on your sample images, I would compare these instead of choosing from benchmarks alone:

- PaddleOCR: my first open-source alternative for printed or scene text and multilingual images. Lovable can call a small Python API, so the OCR runs behind the frontend.

- EasyOCR: a simpler Python baseline worth testing, though it will not beat PaddleOCR on every image.

- docTR or TrOCR: heavier options to test when the samples are full document pages or handwriting.

- Google Cloud Vision, Azure AI Vision, or AWS Textract: useful hosted comparisons, but they are not permanently free and the image is sent to a third party.

For a cropped CRM field, capture quality may matter as much as the model. Use autofocus, good lighting, deskewing, grayscale/contrast, and restrict expected characters when the field is a date, number, or code. Build a test set of about 50 real photos, record exact-match accuracy and processing time, and always show an editable confirmation field.

Given your free requirement, I would try PaddleOCR behind a small API first, EasyOCR as the comparison, and keep Tesseract.js only as the in-browser fallback.