vertex ai, 2.5 pro

This commit is contained in:
2025-12-15 02:16:42 +01:00
parent 7e8e07c1fd
commit cda5496e64
7 changed files with 411 additions and 19 deletions

View File

@@ -137,7 +137,7 @@ def split_files():
key = row["key"]
with conn.cursor() as cur:
logger.info(f"SPLITTING bucket: {bucket}, key: {key}")
logger.info(f"Splitting bucket: {bucket}, key: {key}")
##### get pdf #####
s3.download_file(bucket, key, "/tmp/file.pdf")
@@ -146,6 +146,10 @@ def split_files():
with open("/tmp/file.pdf", "rb") as f:
reader = PdfReader(f)
# Handle PDFs with permission restrictions (no password, but encrypted)
if reader.is_encrypted:
reader.decrypt("")
for i in range(len(reader.pages)):
writer = PdfWriter()
writer.add_page(reader.pages[i])