Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,23 @@ def predict_image(img, conf_threshold, iou_threshold, model_name):
|
|
22 |
)
|
23 |
|
24 |
for r in results:
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
return im
|
29 |
|
|
|
22 |
)
|
23 |
|
24 |
for r in results:
|
25 |
+
im_array1 = r.plot(img=img.copy(), labels=False, line_width=1)
|
26 |
+
im1 = Image.fromarray(im_array1[..., ::-1])
|
27 |
+
|
28 |
+
for r in results:
|
29 |
+
im_array2 = r.plot(img=img.copy(), line_width=1)
|
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("RGB", (total_width, total_height))
|
38 |
+
|
39 |
+
# Paste the images one above the other
|
40 |
+
im.paste(im1, (0, 0))
|
41 |
+
im.paste(im2, (0, im1.height))
|
42 |
|
43 |
return im
|
44 |
|