Skip to content

Commit

Permalink
Update incubator-tools/best-practices/utilities/utilities.py
Browse files Browse the repository at this point in the history
Co-authored-by: Holt Skinner <[email protected]>
  • Loading branch information
dmoonat and holtskinner authored Oct 20, 2023
1 parent 28224e4 commit f02e776
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions incubator-tools/best-practices/utilities/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,8 @@ def create_pdf_from_images(images: Sequence[Image.Image]) -> bytes:
)
return pdf_file.getvalue()

doc = documentai.Document
document = doc.from_json(json.dumps(gt_json))
synthesized_images = []
for i in range(len(document.pages)):
synthesized_images.append(decode_image(document.pages[i].image.content))
document = documentai.Document.from_json(json.dumps(gt_json))
synthesized_images = [decode_image(page.image.content) for page in doc.pages]
pdf_bytes = create_pdf_from_images(synthesized_images)

return pdf_bytes, synthesized_images
Expand Down

0 comments on commit f02e776

Please sign in to comment.