Skip to content

Commit

Permalink
Move dep
Browse files Browse the repository at this point in the history
  • Loading branch information
VikParuchuri committed Feb 7, 2025
1 parent 2cf6a77 commit d560369
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 129 deletions.
6 changes: 3 additions & 3 deletions benchmark/utils/textract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
from surya.input.processing import slice_bboxes_from_image
from surya.recognition import RecognitionPredictor

from textractor import Textractor

def textract_ocr(extractor:Textractor, img):
def textract_ocr(extractor, img):
try:
document = extractor.detect_document_text(file_source=img)
return [line.text for line in document.lines]
Expand All @@ -17,6 +15,8 @@ def textract_ocr(extractor:Textractor, img):
return [None]

def textract_ocr_parallel(imgs, cpus=None):
from textractor import Textractor # Optional dependency

extractor = Textractor(profile_name='default')
parallel_cores = min(len(imgs), RecognitionPredictor().get_batch_size())
if not cpus:
Expand Down
Loading

0 comments on commit d560369

Please sign in to comment.