Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,13 +5,13 @@ import zipfile
|
|
| 5 |
import random
|
| 6 |
|
| 7 |
def random_black_or_white():
|
| 8 |
-
"""返回 (
|
| 9 |
return (0, 0, 0, 255) if random.random() < 0.5 else (255, 255, 255, 255)
|
| 10 |
|
| 11 |
def random_non_black_white():
|
| 12 |
"""
|
| 13 |
-
返回 (r,g,b,a)
|
| 14 |
-
|
| 15 |
"""
|
| 16 |
while True:
|
| 17 |
r = random.randint(0, 255)
|
|
@@ -20,49 +20,41 @@ def random_non_black_white():
|
|
| 20 |
if not (r == g == b == 0 or r == g == b == 255):
|
| 21 |
return (r, g, b, 255)
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def resize_to_64_multiple(img: Image.Image):
|
| 24 |
"""
|
| 25 |
-
|
| 26 |
-
|
| 27 |
"""
|
| 28 |
w, h = img.size
|
| 29 |
-
# 找到最接近的 64 倍数(至少 64)
|
| 30 |
w64 = max(64, round(w / 64) * 64)
|
| 31 |
h64 = max(64, round(h / 64) * 64)
|
| 32 |
-
|
| 33 |
-
# 算缩放比:保证原图能放入 w64*h64
|
| 34 |
-
scale = min(w64 / w, h64 / h)
|
| 35 |
-
new_w = int(w * scale)
|
| 36 |
-
new_h = int(h * scale)
|
| 37 |
-
|
| 38 |
-
# 随机黑或白做背景
|
| 39 |
-
bg_color = random_black_or_white()
|
| 40 |
-
background = Image.new("RGBA", (w64, h64), bg_color)
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
| 50 |
return background
|
| 51 |
|
| 52 |
-
def limit_2048(img: Image.Image):
|
| 53 |
-
"""若图片宽或高 > 2048,则等比例缩小到不超过 2048。"""
|
| 54 |
-
w, h = img.size
|
| 55 |
-
if w > 2048 or h > 2048:
|
| 56 |
-
scale = min(2048 / w, 2048 / h)
|
| 57 |
-
new_w = int(w * scale)
|
| 58 |
-
new_h = int(h * scale)
|
| 59 |
-
img = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
|
| 60 |
-
return img
|
| 61 |
-
|
| 62 |
def make_collage_2x2(images_4):
|
| 63 |
-
"""传入
|
| 64 |
w, h = images_4[0].size
|
| 65 |
-
collage = Image.new("RGBA", (2
|
| 66 |
collage.paste(images_4[0], (0, 0), images_4[0])
|
| 67 |
collage.paste(images_4[1], (w, 0), images_4[1])
|
| 68 |
collage.paste(images_4[2], (0, h), images_4[2])
|
|
@@ -71,135 +63,120 @@ def make_collage_2x2(images_4):
|
|
| 71 |
|
| 72 |
def make_collage_leftover(images_leftover):
|
| 73 |
"""
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
2) 随机选择 (rows, cols) 布局(如 1x1/1x2/2x1/2x2 等)能容纳所有图;
|
| 77 |
-
3) 将图随机放到网格单元,剩余格子用“非黑非白”的纯色填充;
|
| 78 |
-
4) 最后若超出 2048,则缩小。
|
| 79 |
"""
|
| 80 |
n = len(images_leftover)
|
| 81 |
if n < 1 or n > 3:
|
| 82 |
-
return None
|
| 83 |
-
|
| 84 |
-
#
|
| 85 |
-
resized_list = []
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
for
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
if rimg.size[0] > max_w:
|
| 92 |
-
max_w = rimg.size[0]
|
| 93 |
-
if rimg.size[1] > max_h:
|
| 94 |
-
max_h = rimg.size[1]
|
| 95 |
-
|
| 96 |
-
# 再次处理,使它们都成为 (max_w, max_h)
|
| 97 |
-
# (若小于max_w或max_h,就在背景再“居中贴图”)
|
| 98 |
uniformed = []
|
| 99 |
for rimg in resized_list:
|
| 100 |
w, h = rimg.size
|
| 101 |
-
if w == max_w
|
| 102 |
uniformed.append(rimg)
|
| 103 |
else:
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
| 108 |
bg.paste(rimg, (offx, offy), rimg)
|
| 109 |
uniformed.append(bg)
|
| 110 |
|
| 111 |
-
#
|
| 112 |
-
#
|
|
|
|
|
|
|
| 113 |
possible_layouts = []
|
| 114 |
if n == 1:
|
| 115 |
-
# 可以放在 (1x1), (1x2), (2x1), (2x2)
|
| 116 |
possible_layouts = [(1,1), (1,2), (2,1), (2,2)]
|
| 117 |
elif n == 2:
|
| 118 |
-
# (1x2), (2x1), (2x2)
|
| 119 |
possible_layouts = [(1,2), (2,1), (2,2)]
|
| 120 |
else: # n == 3
|
| 121 |
-
# (2x2)
|
| 122 |
possible_layouts = [(2,2)]
|
| 123 |
|
| 124 |
rows, cols = random.choice(possible_layouts)
|
| 125 |
-
|
| 126 |
big_w = cols * max_w
|
| 127 |
big_h = rows * max_h
|
| 128 |
collage = Image.new("RGBA", (big_w, big_h), (0,0,0,255))
|
| 129 |
|
| 130 |
# 网格坐标
|
| 131 |
-
cells = []
|
| 132 |
-
|
| 133 |
-
for c in range(cols):
|
| 134 |
-
cells.append((r,c))
|
| 135 |
|
| 136 |
-
|
| 137 |
-
# 将 n 张图放前 n 个格子
|
| 138 |
for i, img_ in enumerate(uniformed):
|
| 139 |
r, c = cells[i]
|
| 140 |
offset_x = c * max_w
|
| 141 |
offset_y = r * max_h
|
| 142 |
collage.paste(img_, (offset_x, offset_y), img_)
|
| 143 |
|
| 144 |
-
#
|
| 145 |
leftover_cells = cells[n:]
|
| 146 |
for (r, c) in leftover_cells:
|
| 147 |
-
|
| 148 |
-
rect = Image.new("RGBA", (max_w, max_h),
|
| 149 |
-
|
| 150 |
-
offset_y = r * max_h
|
| 151 |
-
collage.paste(rect, (offset_x, offset_y), rect)
|
| 152 |
|
| 153 |
return limit_2048(collage)
|
| 154 |
|
| 155 |
def process_images(uploaded_files):
|
| 156 |
"""
|
| 157 |
-
1)
|
| 158 |
-
2)
|
| 159 |
-
3)
|
| 160 |
-
4) 返回多张结果图(列表)
|
| 161 |
"""
|
| 162 |
pil_images = []
|
| 163 |
for f in uploaded_files:
|
| 164 |
if f is not None:
|
|
|
|
| 165 |
img = Image.open(f.name).convert("RGBA")
|
| 166 |
pil_images.append(img)
|
| 167 |
|
| 168 |
results = []
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
|
| 173 |
-
# 处理完整的 4 张组
|
| 174 |
idx = 0
|
| 175 |
-
|
| 176 |
-
|
|
|
|
| 177 |
idx += 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
# 再次统一(可能有不同64倍数)
|
| 182 |
-
max_w = max([im.size[0] for im in temp])
|
| 183 |
-
max_h = max([im.size[1] for im in temp])
|
| 184 |
-
|
| 185 |
-
uniformed = []
|
| 186 |
-
for rimg in temp:
|
| 187 |
w, h = rimg.size
|
| 188 |
-
if w == max_w
|
| 189 |
-
|
| 190 |
else:
|
| 191 |
-
|
|
|
|
|
|
|
| 192 |
offx = (max_w - w)//2
|
| 193 |
offy = (max_h - h)//2
|
| 194 |
bg.paste(rimg, (offx, offy), rimg)
|
| 195 |
-
|
| 196 |
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
results.append(collage_4)
|
| 200 |
|
| 201 |
-
#
|
| 202 |
-
if
|
| 203 |
leftover_images = pil_images[idx:]
|
| 204 |
collage_left = make_collage_leftover(leftover_images)
|
| 205 |
if collage_left is not None:
|
|
@@ -208,9 +185,11 @@ def process_images(uploaded_files):
|
|
| 208 |
return results
|
| 209 |
|
| 210 |
def make_zip(uploaded_files):
|
| 211 |
-
"""
|
| 212 |
collages = process_images(uploaded_files)
|
|
|
|
| 213 |
if not collages:
|
|
|
|
| 214 |
return None
|
| 215 |
|
| 216 |
buf = io.BytesIO()
|
|
@@ -223,27 +202,44 @@ def make_zip(uploaded_files):
|
|
| 223 |
buf.seek(0)
|
| 224 |
return buf
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
with gr.Blocks() as demo:
|
| 227 |
-
gr.Markdown("##
|
| 228 |
-
gr.Markdown(
|
| 229 |
-
"1. 一次可上传多张图片,每 4 张为一组严格 2×2 拼接;\n"
|
| 230 |
-
"2. 若最后不足 4 张 (1~3),会随机选择网格大小 (1x1,1x2,2x1,2x2),并随机分配位置;\n"
|
| 231 |
-
" 剩余空格用“非黑非白”的随机颜色填充;\n"
|
| 232 |
-
"3. 每张图先按 64 的倍数就近缩放,空余处随机黑/白 (50% 概率);\n"
|
| 233 |
-
"4. 拼出的图若任一边超 2048,则等比例缩小到不超 2048;\n"
|
| 234 |
-
"5. 保留 PNG 透明度,背景填充只在超出区域;\n"
|
| 235 |
-
"6. 生成结果可预览,也可打包下载成 ZIP。"
|
| 236 |
-
)
|
| 237 |
with gr.Row():
|
| 238 |
with gr.Column():
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
with gr.Column():
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
-
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
|
| 249 |
demo.launch()
|
|
|
|
| 5 |
import random
|
| 6 |
|
| 7 |
def random_black_or_white():
|
| 8 |
+
"""返回 RGBA (黑 或 白),50% 概率"""
|
| 9 |
return (0, 0, 0, 255) if random.random() < 0.5 else (255, 255, 255, 255)
|
| 10 |
|
| 11 |
def random_non_black_white():
|
| 12 |
"""
|
| 13 |
+
返回 (r,g,b,a),且不是纯黑(0,0,0)也不是纯白(255,255,255)。
|
| 14 |
+
用于最后不足4张时的空格颜色填充。
|
| 15 |
"""
|
| 16 |
while True:
|
| 17 |
r = random.randint(0, 255)
|
|
|
|
| 20 |
if not (r == g == b == 0 or r == g == b == 255):
|
| 21 |
return (r, g, b, 255)
|
| 22 |
|
| 23 |
+
def limit_2048(img: Image.Image):
|
| 24 |
+
"""若宽或高大于2048,则等比例缩小到不超过2048。"""
|
| 25 |
+
w, h = img.size
|
| 26 |
+
if w > 2048 or h > 2048:
|
| 27 |
+
scale = min(2048 / w, 2048 / h)
|
| 28 |
+
new_w = int(w * scale)
|
| 29 |
+
new_h = int(h * scale)
|
| 30 |
+
img = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
|
| 31 |
+
return img
|
| 32 |
+
|
| 33 |
def resize_to_64_multiple(img: Image.Image):
|
| 34 |
"""
|
| 35 |
+
将图像就近缩放到(w', h'),其中 w'、h'均为64倍数(至少64)。
|
| 36 |
+
空余区域随机黑/白填充,保留透明度。
|
| 37 |
"""
|
| 38 |
w, h = img.size
|
|
|
|
| 39 |
w64 = max(64, round(w / 64) * 64)
|
| 40 |
h64 = max(64, round(h / 64) * 64)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
scale = min(w64 / w, h64 / h)
|
| 43 |
+
nw = int(w * scale)
|
| 44 |
+
nh = int(h * scale)
|
| 45 |
|
| 46 |
+
bg_color = random_black_or_white()
|
| 47 |
+
background = Image.new("RGBA", (w64, h64), bg_color)
|
| 48 |
+
scaled = img.resize((nw, nh), Image.Resampling.LANCZOS)
|
| 49 |
+
ox = (w64 - nw) // 2
|
| 50 |
+
oy = (h64 - nh) // 2
|
| 51 |
+
background.paste(scaled, (ox, oy), scaled)
|
| 52 |
return background
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
def make_collage_2x2(images_4):
|
| 55 |
+
"""传入4张同尺寸RGBA,以2×2拼接,并限制在2048以内。"""
|
| 56 |
w, h = images_4[0].size
|
| 57 |
+
collage = Image.new("RGBA", (2*w, 2*h), (0, 0, 0, 255))
|
| 58 |
collage.paste(images_4[0], (0, 0), images_4[0])
|
| 59 |
collage.paste(images_4[1], (w, 0), images_4[1])
|
| 60 |
collage.paste(images_4[2], (0, h), images_4[2])
|
|
|
|
| 63 |
|
| 64 |
def make_collage_leftover(images_leftover):
|
| 65 |
"""
|
| 66 |
+
针对不足4张(1~3)的情况,随机布局(1x1,1x2,2x1,2x2等)容纳这些图片,
|
| 67 |
+
其余空格以“非黑非白”的纯色填充,并最终限制2048以内。
|
|
|
|
|
|
|
|
|
|
| 68 |
"""
|
| 69 |
n = len(images_leftover)
|
| 70 |
if n < 1 or n > 3:
|
| 71 |
+
return None
|
| 72 |
+
|
| 73 |
+
# 先做“64倍数随机黑/白填充”缩放
|
| 74 |
+
resized_list = [resize_to_64_multiple(img) for img in images_leftover]
|
| 75 |
+
# 找最大宽、高,统一尺寸
|
| 76 |
+
max_w = max(im.size[0] for im in resized_list)
|
| 77 |
+
max_h = max(im.size[1] for im in resized_list)
|
| 78 |
+
|
| 79 |
+
# 再居中贴到背景 (max_w, max_h) 保证每张图一致
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
uniformed = []
|
| 81 |
for rimg in resized_list:
|
| 82 |
w, h = rimg.size
|
| 83 |
+
if (w, h) == (max_w, max_h):
|
| 84 |
uniformed.append(rimg)
|
| 85 |
else:
|
| 86 |
+
# 用本身的背景色(左上像素)来填充
|
| 87 |
+
bg_color = rimg.getpixel((0,0))
|
| 88 |
+
bg = Image.new("RGBA", (max_w, max_h), bg_color)
|
| 89 |
+
offx = (max_w - w) // 2
|
| 90 |
+
offy = (max_h - h) // 2
|
| 91 |
bg.paste(rimg, (offx, offy), rimg)
|
| 92 |
uniformed.append(bg)
|
| 93 |
|
| 94 |
+
# 选定随机布局
|
| 95 |
+
# n=1: (1x1),(1x2),(2x1),(2x2)
|
| 96 |
+
# n=2: (1x2),(2x1),(2x2)
|
| 97 |
+
# n=3: (2x2)
|
| 98 |
possible_layouts = []
|
| 99 |
if n == 1:
|
|
|
|
| 100 |
possible_layouts = [(1,1), (1,2), (2,1), (2,2)]
|
| 101 |
elif n == 2:
|
|
|
|
| 102 |
possible_layouts = [(1,2), (2,1), (2,2)]
|
| 103 |
else: # n == 3
|
|
|
|
| 104 |
possible_layouts = [(2,2)]
|
| 105 |
|
| 106 |
rows, cols = random.choice(possible_layouts)
|
| 107 |
+
|
| 108 |
big_w = cols * max_w
|
| 109 |
big_h = rows * max_h
|
| 110 |
collage = Image.new("RGBA", (big_w, big_h), (0,0,0,255))
|
| 111 |
|
| 112 |
# 网格坐标
|
| 113 |
+
cells = [(r, c) for r in range(rows) for c in range(cols)]
|
| 114 |
+
random.shuffle(cells)
|
|
|
|
|
|
|
| 115 |
|
| 116 |
+
# 把uniformed中的图贴到前n个格子
|
|
|
|
| 117 |
for i, img_ in enumerate(uniformed):
|
| 118 |
r, c = cells[i]
|
| 119 |
offset_x = c * max_w
|
| 120 |
offset_y = r * max_h
|
| 121 |
collage.paste(img_, (offset_x, offset_y), img_)
|
| 122 |
|
| 123 |
+
# 剩余格子(空格)用“非黑非白”的随机色填充
|
| 124 |
leftover_cells = cells[n:]
|
| 125 |
for (r, c) in leftover_cells:
|
| 126 |
+
color_ = random_non_black_white()
|
| 127 |
+
rect = Image.new("RGBA", (max_w, max_h), color_)
|
| 128 |
+
collage.paste(rect, (c*max_w, r*max_h), rect)
|
|
|
|
|
|
|
| 129 |
|
| 130 |
return limit_2048(collage)
|
| 131 |
|
| 132 |
def process_images(uploaded_files):
|
| 133 |
"""
|
| 134 |
+
1) 分成若干4张组 => each 2x2;
|
| 135 |
+
2) 对最后剩余(1~3张),make_collage_leftover 处理。
|
| 136 |
+
3) 返回所有结果图
|
|
|
|
| 137 |
"""
|
| 138 |
pil_images = []
|
| 139 |
for f in uploaded_files:
|
| 140 |
if f is not None:
|
| 141 |
+
# 保留透明
|
| 142 |
img = Image.open(f.name).convert("RGBA")
|
| 143 |
pil_images.append(img)
|
| 144 |
|
| 145 |
results = []
|
| 146 |
+
total = len(pil_images)
|
| 147 |
+
groups_4 = total // 4
|
| 148 |
+
leftover = total % 4
|
| 149 |
|
|
|
|
| 150 |
idx = 0
|
| 151 |
+
# 先拼满4张的组
|
| 152 |
+
for _ in range(groups_4):
|
| 153 |
+
group_4 = pil_images[idx:idx+4]
|
| 154 |
idx += 4
|
| 155 |
+
# 每张先resize
|
| 156 |
+
resized_4 = [resize_to_64_multiple(im) for im in group_4]
|
| 157 |
+
# 再统一max_w, max_h
|
| 158 |
+
max_w = max(im.size[0] for im in resized_4)
|
| 159 |
+
max_h = max(im.size[1] for im in resized_4)
|
| 160 |
|
| 161 |
+
final_4 = []
|
| 162 |
+
for rimg in resized_4:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
w, h = rimg.size
|
| 164 |
+
if (w, h) == (max_w, max_h):
|
| 165 |
+
final_4.append(rimg)
|
| 166 |
else:
|
| 167 |
+
# 补背景居中
|
| 168 |
+
bg_color = rimg.getpixel((0,0))
|
| 169 |
+
bg = Image.new("RGBA", (max_w, max_h), bg_color)
|
| 170 |
offx = (max_w - w)//2
|
| 171 |
offy = (max_h - h)//2
|
| 172 |
bg.paste(rimg, (offx, offy), rimg)
|
| 173 |
+
final_4.append(bg)
|
| 174 |
|
| 175 |
+
collage_2x2 = make_collage_2x2(final_4)
|
| 176 |
+
results.append(collage_2x2)
|
|
|
|
| 177 |
|
| 178 |
+
# 再拼 leftover 1~3张
|
| 179 |
+
if leftover > 0:
|
| 180 |
leftover_images = pil_images[idx:]
|
| 181 |
collage_left = make_collage_leftover(leftover_images)
|
| 182 |
if collage_left is not None:
|
|
|
|
| 185 |
return results
|
| 186 |
|
| 187 |
def make_zip(uploaded_files):
|
| 188 |
+
"""把所有拼接结果打包成zip并返回给Gradio的File组件。"""
|
| 189 |
collages = process_images(uploaded_files)
|
| 190 |
+
# 若无生成任何拼图
|
| 191 |
if not collages:
|
| 192 |
+
# 返回 None 说明无法下载;会显示“无可下载内容”提示
|
| 193 |
return None
|
| 194 |
|
| 195 |
buf = io.BytesIO()
|
|
|
|
| 202 |
buf.seek(0)
|
| 203 |
return buf
|
| 204 |
|
| 205 |
+
def on_zip_click(files):
|
| 206 |
+
"""
|
| 207 |
+
用来返回 (zip_file_obj, message_str) 两个输出:
|
| 208 |
+
1) zip_file_obj 要么是zip流,要么是None;
|
| 209 |
+
2) message_str 用于提示结果或错误。
|
| 210 |
+
"""
|
| 211 |
+
z = make_zip(files)
|
| 212 |
+
if z is None:
|
| 213 |
+
return (None, "无可下载内容 - 请检查是否上传了图片或剩余不足4张且无法拼图")
|
| 214 |
+
else:
|
| 215 |
+
return (z, "打包完成!可点击上方链接下载。")
|
| 216 |
+
|
| 217 |
with gr.Blocks() as demo:
|
| 218 |
+
gr.Markdown("## 2×2 拼接小工具(支持最后不足4张、随机填充、保留透明)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
with gr.Row():
|
| 220 |
with gr.Column():
|
| 221 |
+
file_input = gr.Files(label="上传多张图片", file_types=["image"])
|
| 222 |
+
preview_btn = gr.Button("生成预览")
|
| 223 |
+
zip_btn = gr.Button("打包下载 ZIP")
|
| 224 |
with gr.Column():
|
| 225 |
+
# 不使用 .style() 以兼容老Gradio
|
| 226 |
+
gallery_out = gr.Gallery(label="拼接结果预览", columns=2)
|
| 227 |
+
# 一开始就 visible=True,这样点击按钮后能马上显示下载链接
|
| 228 |
+
zip_file_out = gr.File(label="点击下载打包结果", visible=True, interactive=False)
|
| 229 |
+
msg_output = gr.Textbox(label="处理信息", interactive=False)
|
| 230 |
+
|
| 231 |
+
# 生成预览
|
| 232 |
+
preview_btn.click(
|
| 233 |
+
fn=process_images,
|
| 234 |
+
inputs=[file_input],
|
| 235 |
+
outputs=[gallery_out]
|
| 236 |
+
)
|
| 237 |
|
| 238 |
+
# 打包下载ZIP,额外给一个文本提示
|
| 239 |
+
zip_btn.click(
|
| 240 |
+
fn=on_zip_click,
|
| 241 |
+
inputs=[file_input],
|
| 242 |
+
outputs=[zip_file_out, msg_output]
|
| 243 |
+
)
|
| 244 |
|
| 245 |
demo.launch()
|