pavansuresh commited on
Commit
dfcd327
·
verified ·
1 Parent(s): d893cea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -179,11 +179,12 @@ def save_record_to_salesforce(annotated_image_url, coverage_percent, original_im
179
  })
180
 
181
  def process_image(input_img, brightness_threshold=150):
 
182
  img = np.array(input_img) # Convert PIL Image to NumPy array
183
  img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) # Convert from RGB to BGR
184
-
185
- # Resize large images for faster processing, preserving aspect ratio
186
- max_dim = 640
187
  h, w = img.shape[:2]
188
  if max(h, w) > max_dim:
189
  scale = max_dim / max(h, w)
 
179
  })
180
 
181
  def process_image(input_img, brightness_threshold=150):
182
+ # Resize the image early to improve processing speed
183
  img = np.array(input_img) # Convert PIL Image to NumPy array
184
  img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) # Convert from RGB to BGR
185
+
186
+ # Resize image to reduce the processing time
187
+ max_dim = 640 # Max dimension for resizing
188
  h, w = img.shape[:2]
189
  if max(h, w) > max_dim:
190
  scale = max_dim / max(h, w)