Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -366,6 +366,40 @@ def build_pdf(case: dict, files: list, out_path: str):
|
|
| 366 |
c.drawString(MARGIN, y, f"Upload {idx} — {display_type(f.get('file_type'))}")
|
| 367 |
y -= 0.8*cm
|
| 368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
gl = f.get("geo_location", {}) or {}
|
| 370 |
lat = gl.get("lat")
|
| 371 |
lng = gl.get("lng")
|
|
|
|
| 366 |
c.drawString(MARGIN, y, f"Upload {idx} — {display_type(f.get('file_type'))}")
|
| 367 |
y -= 0.8*cm
|
| 368 |
|
| 369 |
+
# ✅ INTEGRITY VERIFICATION DASHBOARD IMAGE - AT THE TOP BELOW TITLE
|
| 370 |
+
try:
|
| 371 |
+
# Load and display the integrity verification image
|
| 372 |
+
integrity_image_path = "integrity_dashboard.png" # Make sure this file is in your Docker container
|
| 373 |
+
if os.path.exists(integrity_image_path):
|
| 374 |
+
# Position the image right below the title
|
| 375 |
+
integrity_y = y
|
| 376 |
+
|
| 377 |
+
# Display the image - centered and sized appropriately
|
| 378 |
+
image_width = 16*cm # Adjust width as needed
|
| 379 |
+
image_height = 2.5*cm # Adjust height proportionally
|
| 380 |
+
|
| 381 |
+
# Calculate X position to center the image
|
| 382 |
+
center_x = (W - image_width) / 2
|
| 383 |
+
|
| 384 |
+
c.drawImage(
|
| 385 |
+
integrity_image_path,
|
| 386 |
+
center_x, # Centered horizontally
|
| 387 |
+
integrity_y - image_height, # Position below title
|
| 388 |
+
width=image_width,
|
| 389 |
+
height=image_height,
|
| 390 |
+
preserveAspectRatio=True,
|
| 391 |
+
mask='auto'
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# Adjust the Y position for the following content (image + some spacing)
|
| 395 |
+
y = integrity_y - image_height - 0.8*cm
|
| 396 |
+
else:
|
| 397 |
+
print(f"Warning: Integrity image not found at {integrity_image_path}")
|
| 398 |
+
y -= 0.5*cm
|
| 399 |
+
except Exception as e:
|
| 400 |
+
print(f"Warning: Could not load integrity image: {e}")
|
| 401 |
+
y -= 0.5*cm
|
| 402 |
+
|
| 403 |
gl = f.get("geo_location", {}) or {}
|
| 404 |
lat = gl.get("lat")
|
| 405 |
lng = gl.get("lng")
|