mo-mittal commited on
Commit
f6f4455
1 Parent(s): a07871a

Update data_preprocessing.py

Browse files
Files changed (1) hide show
  1. data_preprocessing.py +0 -3
data_preprocessing.py CHANGED
@@ -39,15 +39,12 @@ def ocr_image(index):
39
  print(f'Sublime! Processed img at {index}')
40
  return text
41
  except Exception as e:
42
- # Print error message for any kind of Exception
43
- # print(f"Error processing image at index {index}: {e}")
44
  return None
45
 
46
  # Create a ThreadPoolExecutor to parallelize image processing.
47
  num_workers = 8 # Adjust this number based on your machine's capabilities.
48
  imgur_text = []
49
 
50
- # Use ThreadPoolExecutor to create a pool of threads.
51
  with ThreadPoolExecutor(max_workers=num_workers) as executor:
52
  # Use map to apply 'ocr_image' function to each index.
53
  results = list(executor.map(ocr_image, range(len(dataset['train']))))
 
39
  print(f'Sublime! Processed img at {index}')
40
  return text
41
  except Exception as e:
 
 
42
  return None
43
 
44
  # Create a ThreadPoolExecutor to parallelize image processing.
45
  num_workers = 8 # Adjust this number based on your machine's capabilities.
46
  imgur_text = []
47
 
 
48
  with ThreadPoolExecutor(max_workers=num_workers) as executor:
49
  # Use map to apply 'ocr_image' function to each index.
50
  results = list(executor.map(ocr_image, range(len(dataset['train']))))