WebashalarForML commited on
Commit
15e03b2
1 Parent(s): 4d91180

Update utility/utils.py

Browse files
Files changed (1) hide show
  1. utility/utils.py +11 -1
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(
@@ -157,8 +158,17 @@ def extract_text_from_images(image_paths):
157
  img_result = Image.fromarray(enhanced_image)
158
  #img_with_boxes = draw_boxes(img_result, boxes)
159
 
 
 
 
 
 
 
 
 
 
160
  # Save the image with boxes
161
- result_image_path = os.path.join(RESULT_FOLDER, f'result_{os.path.basename(image_path)}')
162
  #img_with_boxes.save(result_image_path)
163
  cv2.imwrite(result_image_path, img_with_boxes)
164
 
 
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(
 
158
  img_result = Image.fromarray(enhanced_image)
159
  #img_with_boxes = draw_boxes(img_result, boxes)
160
 
161
+ # genrating unique id to save the images
162
+ # Get the current date and time
163
+ current_time = datetime.now()
164
+
165
+ # Format it as a string to create a unique ID
166
+ unique_id = current_time.strftime("%Y%m%d%H%M%S%f")
167
+
168
+ #print(unique_id)
169
+
170
  # Save the image with boxes
171
+ result_image_path = os.path.join(RESULT_FOLDER, f'result_{unique_id}_{os.path.basename(image_path)}')
172
  #img_with_boxes.save(result_image_path)
173
  cv2.imwrite(result_image_path, img_with_boxes)
174