Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1685,6 +1685,7 @@ def extract_images_from_pdf(pdf_path: Path):
|
|
1685 |
extract_image_block_types=["Image"],
|
1686 |
extract_image_block_to_payload=True,
|
1687 |
)
|
|
|
1688 |
except Exception as e:
|
1689 |
raise RuntimeError(
|
1690 |
f"❌ Failed to extract images from PDF: {str(e)}")
|
@@ -1751,7 +1752,7 @@ def extract_images_from_pdf(pdf_path: Path):
|
|
1751 |
image.save(img_buffer, format="PNG")
|
1752 |
img_bytes = img_buffer.getvalue()
|
1753 |
img_base64 = base64.b64encode(img_bytes).decode("utf-8")
|
1754 |
-
|
1755 |
# Optionally save image to disk if desired for debugging/permanent storage
|
1756 |
image_path = extracted_image_subdir / f"Sprite_{i+1}.png"
|
1757 |
image.save(image_path)
|
@@ -1801,6 +1802,7 @@ def extract_images_from_pdf(pdf_path: Path):
|
|
1801 |
"description": description
|
1802 |
}
|
1803 |
sprite_count += 1
|
|
|
1804 |
except Exception as e:
|
1805 |
logger.error(f"⚠️ Error processing Sprite {i+1}: {str(e)}", exc_info=True)
|
1806 |
|
|
|
1685 |
extract_image_block_types=["Image"],
|
1686 |
extract_image_block_to_payload=True,
|
1687 |
)
|
1688 |
+
print(f"ELEMENTS")
|
1689 |
except Exception as e:
|
1690 |
raise RuntimeError(
|
1691 |
f"❌ Failed to extract images from PDF: {str(e)}")
|
|
|
1752 |
image.save(img_buffer, format="PNG")
|
1753 |
img_bytes = img_buffer.getvalue()
|
1754 |
img_base64 = base64.b64encode(img_bytes).decode("utf-8")
|
1755 |
+
|
1756 |
# Optionally save image to disk if desired for debugging/permanent storage
|
1757 |
image_path = extracted_image_subdir / f"Sprite_{i+1}.png"
|
1758 |
image.save(image_path)
|
|
|
1802 |
"description": description
|
1803 |
}
|
1804 |
sprite_count += 1
|
1805 |
+
print(f"\n===================manipulated JSON: {manipulated_json}")
|
1806 |
except Exception as e:
|
1807 |
logger.error(f"⚠️ Error processing Sprite {i+1}: {str(e)}", exc_info=True)
|
1808 |
|