Spaces:
Running
on
Zero
Running
on
Zero
bo.l
commited on
Commit
·
2d539cf
1
Parent(s):
127672a
max area contorl
Browse files
app.py
CHANGED
|
@@ -89,8 +89,8 @@ def infer(
|
|
| 89 |
|
| 90 |
|
| 91 |
# 规范宽高:不超过 MAX_IMAGE_SIZE 且对齐到 16
|
| 92 |
-
width = max(16, min(width,
|
| 93 |
-
height = max(16, min(height,
|
| 94 |
|
| 95 |
# 随机种子
|
| 96 |
if randomize_seed:
|
|
@@ -98,7 +98,7 @@ def infer(
|
|
| 98 |
generator = torch.Generator(device=device).manual_seed(int(seed))
|
| 99 |
|
| 100 |
# 参考图按桶缩放
|
| 101 |
-
raw_images = resize_by_bucket(refs, resolution=
|
| 102 |
|
| 103 |
# 推理
|
| 104 |
with torch.no_grad():
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
# 规范宽高:不超过 MAX_IMAGE_SIZE 且对齐到 16
|
| 92 |
+
width = max(16, min(width, max_area)) // 16 * 16
|
| 93 |
+
height = max(16, min(height, max_area)) // 16 * 16
|
| 94 |
|
| 95 |
# 随机种子
|
| 96 |
if randomize_seed:
|
|
|
|
| 98 |
generator = torch.Generator(device=device).manual_seed(int(seed))
|
| 99 |
|
| 100 |
# 参考图按桶缩放
|
| 101 |
+
raw_images = resize_by_bucket(refs, resolution=max_area)
|
| 102 |
|
| 103 |
# 推理
|
| 104 |
with torch.no_grad():
|