Spaces:
Running
on
Zero
Running
on
Zero
修改image output size
Browse files- ominicontrol.py +8 -0
ominicontrol.py
CHANGED
|
@@ -63,6 +63,8 @@ def generate_image(
|
|
| 63 |
}[style]
|
| 64 |
pipe.set_adapters(activate_adapter_name)
|
| 65 |
|
|
|
|
|
|
|
| 66 |
factor = 512 / max(image.size)
|
| 67 |
image = resize(
|
| 68 |
image.resize(
|
|
@@ -102,6 +104,12 @@ def generate_image(
|
|
| 102 |
1.5: (960, 640),
|
| 103 |
}[ratio]
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
print(
|
| 106 |
f"Image Ratio: {image_ratio}, Inference Mode: {inference_mode}, Image Guidance: {image_guidance}, Seed: {seed}, Steps: {steps}, Size: {width}x{height}"
|
| 107 |
)
|
|
|
|
| 63 |
}[style]
|
| 64 |
pipe.set_adapters(activate_adapter_name)
|
| 65 |
|
| 66 |
+
original_width, original_height = image.size
|
| 67 |
+
|
| 68 |
factor = 512 / max(image.size)
|
| 69 |
image = resize(
|
| 70 |
image.resize(
|
|
|
|
| 104 |
1.5: (960, 640),
|
| 105 |
}[ratio]
|
| 106 |
|
| 107 |
+
|
| 108 |
+
output_factor = 640 / max(original_width, original_height)
|
| 109 |
+
width = int(original_width * output_factor)
|
| 110 |
+
height = int(original_height * output_factor)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
print(
|
| 114 |
f"Image Ratio: {image_ratio}, Inference Mode: {inference_mode}, Image Guidance: {image_guidance}, Seed: {seed}, Steps: {steps}, Size: {width}x{height}"
|
| 115 |
)
|