Skip to content

Commit

Permalink
close pdf (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
magdaaniol authored Dec 23, 2024
1 parent 4034df2 commit bc295d2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions prodigy_pdf/spans.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ def pdf_to_images(path: Path) -> List[str]:
pil_image.save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue())
images.append(f"data:image/png;base64,{img_str.decode('utf-8')}")
return images

try:
return images
finally:
pdf.close()

def disable_tokens(stream: StreamType, disabled: List[str]) -> StreamType:
for eg in stream:
Expand Down

0 comments on commit bc295d2

Please sign in to comment.