Spaces:
Sleeping
Sleeping
Remove saving image to disk
Browse files
app/services/panServices/panOcr.py
CHANGED
|
@@ -24,7 +24,7 @@ def process_results(results, img):
|
|
| 24 |
x1, y1, x2, y2 = map(int, bbox.tolist())
|
| 25 |
crop_img = img.crop((x1, y1, x2, y2))
|
| 26 |
crop_img = resize_if_needed(crop_img)
|
| 27 |
-
crop_img.save(f"temp_{label}.png")
|
| 28 |
cropped_images_with_labels.append((crop_img, label_indices[label], conf))
|
| 29 |
precision_data[label]["total"] += 1
|
| 30 |
precision_data[label]["correct"] += 1 # Replace with actual OCR validation check
|
|
@@ -40,7 +40,7 @@ def process_results(results, img):
|
|
| 40 |
|
| 41 |
final_image = all_cropped_images_to_one_image(cropped_images, separator_image_path='app/utils/seprator3.png')
|
| 42 |
buffer = BytesIO()
|
| 43 |
-
final_image.save(buffer, format=input_image_format)
|
| 44 |
buffer.seek(0)
|
| 45 |
|
| 46 |
response = analyze_image(buffer.getvalue(), input_image_format)
|
|
|
|
| 24 |
x1, y1, x2, y2 = map(int, bbox.tolist())
|
| 25 |
crop_img = img.crop((x1, y1, x2, y2))
|
| 26 |
crop_img = resize_if_needed(crop_img)
|
| 27 |
+
# crop_img.save(f"temp_{label}.png")
|
| 28 |
cropped_images_with_labels.append((crop_img, label_indices[label], conf))
|
| 29 |
precision_data[label]["total"] += 1
|
| 30 |
precision_data[label]["correct"] += 1 # Replace with actual OCR validation check
|
|
|
|
| 40 |
|
| 41 |
final_image = all_cropped_images_to_one_image(cropped_images, separator_image_path='app/utils/seprator3.png')
|
| 42 |
buffer = BytesIO()
|
| 43 |
+
# final_image.save(buffer, format=input_image_format)
|
| 44 |
buffer.seek(0)
|
| 45 |
|
| 46 |
response = analyze_image(buffer.getvalue(), input_image_format)
|