fix: use bucket system for inference resolution to prevent content cropping, then resize back to original
Browse files
app.py
CHANGED
|
@@ -386,9 +386,9 @@ def prepare_images_before_pipe(
|
|
| 386 |
|
| 387 |
base_w, base_h = pil_images[0].size
|
| 388 |
|
| 389 |
-
#
|
| 390 |
-
|
| 391 |
-
target_h =
|
| 392 |
|
| 393 |
processed = []
|
| 394 |
for img in pil_images:
|
|
|
|
| 386 |
|
| 387 |
base_w, base_h = pil_images[0].size
|
| 388 |
|
| 389 |
+
# 用 bucket 系统选择最佳推理分辨率(~1MP),匹配模型训练分辨率
|
| 390 |
+
# 避免原图分辨率过大/过小导致内容偏移或裁剪
|
| 391 |
+
target_w, target_h = pick_best_bucket(base_w, base_h, SAFE_BUCKETS, allow_upscale)
|
| 392 |
|
| 393 |
processed = []
|
| 394 |
for img in pil_images:
|