Spaces:
Runtime error
Runtime error
Update utility/utils.py
Browse files- utility/utils.py +10 -0
utility/utils.py
CHANGED
|
@@ -10,6 +10,7 @@ import cv2
|
|
| 10 |
import numpy as np
|
| 11 |
from paddleocr import PaddleOCR
|
| 12 |
import logging
|
|
|
|
| 13 |
|
| 14 |
# Configure logging
|
| 15 |
logging.basicConfig(
|
|
@@ -156,6 +157,15 @@ def extract_text_from_images(image_paths):
|
|
| 156 |
img_result = Image.fromarray(enhanced_image)
|
| 157 |
#img_with_boxes = draw_boxes(img_result, boxes)
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
# Save the image with boxes
|
| 160 |
result_image_path = os.path.join(RESULT_FOLDER, f'result_{os.path.basename(image_path)}')
|
| 161 |
#img_with_boxes.save(result_image_path)
|
|
|
|
| 10 |
import numpy as np
|
| 11 |
from paddleocr import PaddleOCR
|
| 12 |
import logging
|
| 13 |
+
from datetime import datetime
|
| 14 |
|
| 15 |
# Configure logging
|
| 16 |
logging.basicConfig(
|
|
|
|
| 157 |
img_result = Image.fromarray(enhanced_image)
|
| 158 |
#img_with_boxes = draw_boxes(img_result, boxes)
|
| 159 |
|
| 160 |
+
# genrating unique id to save the images
|
| 161 |
+
# Get the current date and time
|
| 162 |
+
current_time = datetime.now()
|
| 163 |
+
|
| 164 |
+
# Format it as a string to create a unique ID
|
| 165 |
+
unique_id = current_time.strftime("%Y%m%d%H%M%S%f")
|
| 166 |
+
|
| 167 |
+
#print(unique_id)
|
| 168 |
+
|
| 169 |
# Save the image with boxes
|
| 170 |
result_image_path = os.path.join(RESULT_FOLDER, f'result_{os.path.basename(image_path)}')
|
| 171 |
#img_with_boxes.save(result_image_path)
|