Spaces:
Sleeping
Sleeping
sqlite error
Browse files
draft_computation/draft_computation_app/app.py
CHANGED
|
@@ -159,6 +159,7 @@ def calculate_draft(pose_results, segment_data, original_image):
|
|
| 159 |
'last_valid_keypoint_cm': last_valid_keypoint_cm,
|
| 160 |
'cm_distance': cm_distance,
|
| 161 |
'final_draft_cm': final_draft_cm,
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
return final_draft, mid_results
|
|
|
|
| 159 |
'last_valid_keypoint_cm': last_valid_keypoint_cm,
|
| 160 |
'cm_distance': cm_distance,
|
| 161 |
'final_draft_cm': final_draft_cm,
|
| 162 |
+
'extracted_mark_image': meter_mark_image
|
| 163 |
}
|
| 164 |
|
| 165 |
return final_draft, mid_results
|
draft_computation/endpoint.py
CHANGED
|
@@ -36,6 +36,7 @@ def run(img_path_or_array):
|
|
| 36 |
"original_image": results1[0].orig_img,
|
| 37 |
"pose_image_result": results1[0].plot(),
|
| 38 |
"segment_image_result": results2[0].plot(),
|
|
|
|
| 39 |
}
|
| 40 |
output['final_image_result'] = combine_plots(output['original_image'],
|
| 41 |
output['pose_image_result'],
|
|
|
|
| 36 |
"original_image": results1[0].orig_img,
|
| 37 |
"pose_image_result": results1[0].plot(),
|
| 38 |
"segment_image_result": results2[0].plot(),
|
| 39 |
+
"extracted_mark_image": mid_results['extracted_mark_image']
|
| 40 |
}
|
| 41 |
output['final_image_result'] = combine_plots(output['original_image'],
|
| 42 |
output['pose_image_result'],
|
services/pdf_service.py
CHANGED
|
@@ -94,10 +94,17 @@ class PdfService:
|
|
| 94 |
current_x = x_start
|
| 95 |
|
| 96 |
# Draw original image
|
| 97 |
-
if 'original_image' in ml_results and ml_results['original_image'] is not None:
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
if original_img_bytes:
|
| 100 |
-
p.drawString(current_x, y_image_row + image_height + 5, "
|
| 101 |
p.drawImage(ImageReader(BytesIO(original_img_bytes)), current_x, y_image_row, width=image_width, height=image_height, preserveAspectRatio=True)
|
| 102 |
current_x += image_width + 20 # Move x for next image
|
| 103 |
|
|
|
|
| 94 |
current_x = x_start
|
| 95 |
|
| 96 |
# Draw original image
|
| 97 |
+
# if 'original_image' in ml_results and ml_results['original_image'] is not None:
|
| 98 |
+
# original_img_bytes = get_image_bytes(ml_results['original_image'])
|
| 99 |
+
# if original_img_bytes:
|
| 100 |
+
# p.drawString(current_x, y_image_row + image_height + 5, "Original Image:") # Label above image
|
| 101 |
+
# p.drawImage(ImageReader(BytesIO(original_img_bytes)), current_x, y_image_row, width=image_width, height=image_height, preserveAspectRatio=True)
|
| 102 |
+
# current_x += image_width + 20 # Move x for next image
|
| 103 |
+
|
| 104 |
+
if 'extracted_mark_image' in ml_results and ml_results['extracted_mark_image'] is not None:
|
| 105 |
+
original_img_bytes = get_image_bytes(ml_results['extracted_mark_image'])
|
| 106 |
if original_img_bytes:
|
| 107 |
+
p.drawString(current_x, y_image_row + image_height + 5, "Extracted Mark Image:") # Label above image
|
| 108 |
p.drawImage(ImageReader(BytesIO(original_img_bytes)), current_x, y_image_row, width=image_width, height=image_height, preserveAspectRatio=True)
|
| 109 |
current_x += image_width + 20 # Move x for next image
|
| 110 |
|