Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 =
|
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 =
|
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 =
|
82 |
-
|
83 |
-
cv2.imwrite('imagenes/row2_before.png', row2_img)
|
84 |
|
85 |
for i in range(4-len(img_array)):
|
86 |
-
row2_img =
|
87 |
-
|
88 |
-
cv2.imwrite('imagenes/row2_after.png', row2_img)
|
89 |
|
90 |
-
final_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:
|