Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -45,12 +45,21 @@ def process_image(input_image):
|
|
45 |
# 将 Gradio 输入转换为 PIL 图像
|
46 |
input_image = Image.fromarray(input_image)
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
# 处理图像
|
49 |
pipe_out = pipe(
|
50 |
image=input_image,
|
51 |
prompt="remove glass reflection",
|
52 |
vae_2=vae_2,
|
53 |
-
processing_resolution=
|
54 |
)
|
55 |
|
56 |
# 将输出转换为图像
|
|
|
45 |
# 将 Gradio 输入转换为 PIL 图像
|
46 |
input_image = Image.fromarray(input_image)
|
47 |
|
48 |
+
# 根据输入图像的大小设置分辨率
|
49 |
+
max_side = max(input_image.size)
|
50 |
+
if max_side < 768:
|
51 |
+
resolution = 768
|
52 |
+
elif max_side > 2560:
|
53 |
+
resolution = 2560
|
54 |
+
else:
|
55 |
+
resolution = 0
|
56 |
+
|
57 |
# 处理图像
|
58 |
pipe_out = pipe(
|
59 |
image=input_image,
|
60 |
prompt="remove glass reflection",
|
61 |
vae_2=vae_2,
|
62 |
+
processing_resolution=resolution,
|
63 |
)
|
64 |
|
65 |
# 将输出转换为图像
|