Spaces:
Running
on
Zero
Running
on
Zero
bo.l
commited on
Commit
·
058ae01
1
Parent(s):
a8096f5
update multi2
Browse files
app.py
CHANGED
|
@@ -86,8 +86,7 @@ def infer(
|
|
| 86 |
refs = [x for x in (ref1, ref2) if x is not None]
|
| 87 |
if len(refs) == 0:
|
| 88 |
raise gr.Error("请至少上传一张参考图(ref1 或 ref2)。")
|
| 89 |
-
|
| 90 |
-
refs = [[refs[0]],[refs[1]]]
|
| 91 |
|
| 92 |
# 规范宽高:不超过 MAX_IMAGE_SIZE 且对齐到 16
|
| 93 |
width = max(16, min(width, MAX_IMAGE_SIZE)) // 16 * 16
|
|
@@ -102,6 +101,9 @@ def infer(
|
|
| 102 |
base_res = min(width, height, MAX_IMAGE_SIZE)
|
| 103 |
raw_images = resize_by_bucket(refs, resolution=base_res)
|
| 104 |
|
|
|
|
|
|
|
|
|
|
| 105 |
# 推理
|
| 106 |
with torch.no_grad():
|
| 107 |
out = flux_pipeline(
|
|
|
|
| 86 |
refs = [x for x in (ref1, ref2) if x is not None]
|
| 87 |
if len(refs) == 0:
|
| 88 |
raise gr.Error("请至少上传一张参考图(ref1 或 ref2)。")
|
| 89 |
+
|
|
|
|
| 90 |
|
| 91 |
# 规范宽高:不超过 MAX_IMAGE_SIZE 且对齐到 16
|
| 92 |
width = max(16, min(width, MAX_IMAGE_SIZE)) // 16 * 16
|
|
|
|
| 101 |
base_res = min(width, height, MAX_IMAGE_SIZE)
|
| 102 |
raw_images = resize_by_bucket(refs, resolution=base_res)
|
| 103 |
|
| 104 |
+
if len(raw_images) == 2:
|
| 105 |
+
raw_images = [[raw_images[0]],[raw_images[1]]]
|
| 106 |
+
|
| 107 |
# 推理
|
| 108 |
with torch.no_grad():
|
| 109 |
out = flux_pipeline(
|