huzey commited on
Commit
7029b19
1 Parent(s): 6478734
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -4512,6 +4512,8 @@ with demo:
4512
  plt.style.use('dark_background')
4513
 
4514
  def pad_image_with_border(image, border_color, border_width):
 
 
4515
  new_image = np.ones((image.shape[0] + 2 * border_width, image.shape[1] + 2 * border_width, image.shape[2]), dtype=image.dtype)
4516
  new_image[:, :] = border_color
4517
  new_image[border_width:-border_width, border_width:-border_width] = image
 
4512
  plt.style.use('dark_background')
4513
 
4514
  def pad_image_with_border(image, border_color, border_width):
4515
+ if len(image.shape) == 2:
4516
+ image = np.stack([image] * 3, axis=-1)
4517
  new_image = np.ones((image.shape[0] + 2 * border_width, image.shape[1] + 2 * border_width, image.shape[2]), dtype=image.dtype)
4518
  new_image[:, :] = border_color
4519
  new_image[border_width:-border_width, border_width:-border_width] = image