Spaces:
Runtime error
Runtime error
Code refactoring
Browse files
app.py
CHANGED
|
@@ -55,16 +55,16 @@ def create_image(images):
|
|
| 55 |
row_height = 100
|
| 56 |
margin = 10
|
| 57 |
text_margin = 20
|
| 58 |
-
|
| 59 |
-
table_height = text_margin + margin + (row_height + margin) * len(images)
|
| 60 |
|
| 61 |
font = cv2.FONT_HERSHEY_SIMPLEX
|
| 62 |
font_scale = 0.5
|
| 63 |
color = (255, 255, 255)
|
| 64 |
thickness = 2
|
| 65 |
|
|
|
|
|
|
|
| 66 |
table = np.zeros((table_height, table_width, 3), np.uint8)
|
| 67 |
-
id_col_width = 100
|
| 68 |
|
| 69 |
id_x = 10
|
| 70 |
img_x = id_col_width + 10
|
|
@@ -81,6 +81,7 @@ def create_image(images):
|
|
| 81 |
if img_x + new_width > table_width:
|
| 82 |
new_width = table_width - img_x
|
| 83 |
img_resized = cv2.resize(img, (new_width, row_height))
|
|
|
|
| 84 |
cv2.putText(table, str(i), (id_x, y + margin), font, font_scale, color, thickness)
|
| 85 |
table[y:y+row_height, img_x:img_x+new_width] = img_resized
|
| 86 |
|
|
@@ -91,8 +92,8 @@ def create_image(images):
|
|
| 91 |
continue
|
| 92 |
else:
|
| 93 |
break
|
| 94 |
-
|
| 95 |
table_cropped = table[:, :col+1+id_x]
|
|
|
|
| 96 |
return table_cropped
|
| 97 |
|
| 98 |
def check(avatars_zip, photos_zip):
|
|
|
|
| 55 |
row_height = 100
|
| 56 |
margin = 10
|
| 57 |
text_margin = 20
|
| 58 |
+
id_col_width = 100
|
|
|
|
| 59 |
|
| 60 |
font = cv2.FONT_HERSHEY_SIMPLEX
|
| 61 |
font_scale = 0.5
|
| 62 |
color = (255, 255, 255)
|
| 63 |
thickness = 2
|
| 64 |
|
| 65 |
+
table_height = text_margin + margin + (row_height + margin) * len(images)
|
| 66 |
+
|
| 67 |
table = np.zeros((table_height, table_width, 3), np.uint8)
|
|
|
|
| 68 |
|
| 69 |
id_x = 10
|
| 70 |
img_x = id_col_width + 10
|
|
|
|
| 81 |
if img_x + new_width > table_width:
|
| 82 |
new_width = table_width - img_x
|
| 83 |
img_resized = cv2.resize(img, (new_width, row_height))
|
| 84 |
+
|
| 85 |
cv2.putText(table, str(i), (id_x, y + margin), font, font_scale, color, thickness)
|
| 86 |
table[y:y+row_height, img_x:img_x+new_width] = img_resized
|
| 87 |
|
|
|
|
| 92 |
continue
|
| 93 |
else:
|
| 94 |
break
|
|
|
|
| 95 |
table_cropped = table[:, :col+1+id_x]
|
| 96 |
+
|
| 97 |
return table_cropped
|
| 98 |
|
| 99 |
def check(avatars_zip, photos_zip):
|