Skip to content

Commit b2204bc

Browse files
author
Chris Maunder
committed
Notes on passing in PDFs
1 parent adf32e7 commit b2204bc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

multimode_llm_adapter.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ def long_process(self, data: RequestData) -> JSON:
8585
max_tokens: int = data.get_int("max_tokens", 0) #0 means model default
8686
temperature: float = data.get_float("temperature", 0.4)
8787

88+
# If a PDF is passed in:
89+
# import pymupdf
90+
# file_bytes = data.get_file_bytes(0)
91+
# doc = pymupdf.Document(stream=file_bytes)
92+
# for page in doc: # iterate through the pages
93+
# pix = page.get_pixmap() # render page to an image
94+
# pix.save("page-%i.png" % page.number) # store image as a PNG
95+
# # To scale 2X:
96+
# # zoom_x = 2.0 # horizontal zoom
97+
# # zoom_y = 2.0 # vertical zoom
98+
# # mat = pymupdf.Matrix(zoom_x, zoom_y) # zoom factor 2 in each dimension
99+
# # pix = page.get_pixmap(matrix=mat) # use 'mat' instead of the identity matrix
100+
88101
start_process_time = time.perf_counter()
89102

90103
try:

0 commit comments

Comments
 (0)