Skip to content

Commit

Permalink
Merge branch 'main' of github.com:expectedparrot/edsl into q113
Browse files Browse the repository at this point in the history
  • Loading branch information
rbyh committed Jan 29, 2025
2 parents f515e22 + 41d1631 commit 2772569
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion edsl/scenarios/ScenarioListPdfMixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def _from_pdf_to_image(cls, pdf_path, image_format="jpeg"):
:param pdf_path: Path to the PDF file.
:param image_format: Format of the output images (default is 'jpeg').
:return: ScenarioList instance containing the Scenario instances.
The scenario list has keys "filepath", "page", "content".
"""
import tempfile
from pdf2image import convert_from_path
Expand All @@ -171,7 +173,13 @@ def _from_pdf_to_image(cls, pdf_path, image_format="jpeg"):
image_path = os.path.join(output_folder, f"page_{i+1}.{image_format}")
image.save(image_path, image_format.upper())

scenario = Scenario._from_filepath_image(image_path)
# scenario = Scenario._from_filepath_image(image_path)
from edsl import FileStore
scenario = Scenario({
"filepath":image_path,
"page":i,
"content":FileStore(image_path)
})
scenarios.append(scenario)

# print(f"Saved {len(images)} pages as images in {output_folder}")
Expand Down

0 comments on commit 2772569

Please sign in to comment.