ajcasagrande commited on
Commit
60c712e
·
verified ·
1 Parent(s): 217a1f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -23,18 +23,20 @@ def predict_image(img, conf_threshold, iou_threshold, model_name):
23
 
24
  for r in results:
25
  im_array1 = r.plot(img=img.copy(), labels=False, line_width=4)
26
- im1 = Image.fromarray(im_array1[..., ::-1])
27
 
28
  for r in results:
29
  im_array2 = r.plot(img=img.copy(), line_width=4, font_size=10)
30
- im2 = Image.fromarray(im_array2[..., ::-1])
 
 
31
 
32
  # Calculate the dimensions for the output image
33
  total_height = im1.height + im2.height
34
  total_width = im1.width
35
 
36
  # Create a blank image with the combined height
37
- im = Image.new("BGR", (total_width, total_height))
38
 
39
  # Paste the images one above the other
40
  im.paste(im1, (0, 0))
 
23
 
24
  for r in results:
25
  im_array1 = r.plot(img=img.copy(), labels=False, line_width=4)
26
+ im1 = Image.fromarray(cv2.cvtColor(im_array1, cv2.COLOR_BGR2RGB))
27
 
28
  for r in results:
29
  im_array2 = r.plot(img=img.copy(), line_width=4, font_size=10)
30
+ im2 = Image.fromarray(cv2.cvtColor(im_array2, cv2.COLOR_BGR2RGB))
31
+
32
+ im2 = Image.fromarray(cv2.cvtColor(im_array2, cv2.COLOR_BGR2RGB))
33
 
34
  # Calculate the dimensions for the output image
35
  total_height = im1.height + im2.height
36
  total_width = im1.width
37
 
38
  # Create a blank image with the combined height
39
+ im = Image.new("RGB", (total_width, total_height))
40
 
41
  # Paste the images one above the other
42
  im.paste(im1, (0, 0))