i72sijia commited on
Commit
d40a262
1 Parent(s): 700b066

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -17
app.py CHANGED
@@ -8,7 +8,6 @@ from IPython.display import Image
8
  import matplotlib.pyplot as plt
9
 
10
  import gradio as gr
11
- import cv2
12
 
13
  sys.path.insert(0, "/StyleGAN2-GANbanales")
14
 
@@ -55,16 +54,11 @@ def concatenate(img_array):
55
  zeros.fill(255)
56
  white_img = zeros
57
 
58
- a = 1
59
- for i in img_array:
60
- cv2.imwrite('imagenes/' + str(a) + '.png', i)
61
- a+=1
62
-
63
  # 1 - 2 images
64
  if len(img_array) <= 2:
65
  row_img = img_array[0]
66
  for i in img_array[1:]:
67
- row_img = cv2.hconcat([row_img, i])
68
 
69
  final_img = row_img
70
 
@@ -72,22 +66,16 @@ def concatenate(img_array):
72
  elif len(img_array) >= 3 and len(img_array) <= 4:
73
  row1_img = img_array[0]
74
  for i in img_array[1:2]:
75
- row1_img = cv2.hconcat([row1_img, i])
76
-
77
- cv2.imwrite('imagenes/row1.png', row1_img)
78
 
79
  row2_img = img_array[2]
80
  for i in img_array[3:]:
81
- row2_img = cv2.hconcat([row2_img, i])
82
-
83
- cv2.imwrite('imagenes/row2_before.png', row2_img)
84
 
85
  for i in range(4-len(img_array)):
86
- row2_img = cv2.hconcat([row2_img, white_img])
87
-
88
- cv2.imwrite('imagenes/row2_after.png', row2_img)
89
 
90
- final_img = cv2.vconcat([row1_img, row2_img])
91
 
92
  # 5 - 6 images
93
  elif len(img_array) >= 4 and len(img_array) <= 6:
 
8
  import matplotlib.pyplot as plt
9
 
10
  import gradio as gr
 
11
 
12
  sys.path.insert(0, "/StyleGAN2-GANbanales")
13
 
 
54
  zeros.fill(255)
55
  white_img = zeros
56
 
 
 
 
 
 
57
  # 1 - 2 images
58
  if len(img_array) <= 2:
59
  row_img = img_array[0]
60
  for i in img_array[1:]:
61
+ row_img = np.hstack((row_img, i))
62
 
63
  final_img = row_img
64
 
 
66
  elif len(img_array) >= 3 and len(img_array) <= 4:
67
  row1_img = img_array[0]
68
  for i in img_array[1:2]:
69
+ row1_img = np.hstack((row1_img, i))
 
 
70
 
71
  row2_img = img_array[2]
72
  for i in img_array[3:]:
73
+ row2_img = np.hstack((row2_img, i))
 
 
74
 
75
  for i in range(4-len(img_array)):
76
+ row2_img = np.hstack((row2_img, white_img))
 
 
77
 
78
+ final_img = np.vstack((row1_img, row2_img))
79
 
80
  # 5 - 6 images
81
  elif len(img_array) >= 4 and len(img_array) <= 6: