[Bugfix] Honor the requested output canvas in BAGEL img2img (#7287)
Signed-off-by: Ding Zuhao <e1583181@u.nus.edu> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
86fcfe95f1
commit
154a1f25f5
8 files changed
+391
-27
No files matched your search
@@ -1719,7 +1719,7 @@ def test_image_edit_parameter_pass(async_omni_test_client):
|
||||
img = Image.open(io.BytesIO(img_bytes))
|
||||
assert img.format.lower() == "jpeg"
|
||||
assert data["output_format"] == "jpeg"
|
||||
assert data["size"] == "16x24"
|
||||
assert data["size"] == "64x64"
|
||||
|
||||
|
||||
def test_image_edit_layers_and_resolution(async_omni_test_client):
|
||||
@@ -1896,6 +1896,7 @@ def test_image_edit_parameter_default_single_stage(test_client):
|
||||
|
||||
assert captured_sampling_params.width == 24
|
||||
assert captured_sampling_params.height == 16
|
||||
assert (captured_sampling_params.height_not_provided, captured_sampling_params.width_not_provided) == (True, True)
|
||||
assert captured_sampling_params.num_outputs_per_prompt == 1
|
||||
assert captured_sampling_params.num_inference_steps == 4
|
||||
assert captured_sampling_params.guidance_scale == 7.5
|
||||
@@ -1913,6 +1914,40 @@ def test_image_edit_parameter_default_single_stage(test_client):
|
||||
assert response.status_code == 400
|
||||
|
||||
|
||||
def test_image_edit_explicit_size_marks_canvas_provided_single_stage(test_client):
|
||||
response = test_client.post(
|
||||
"/v1/images/edits",
|
||||
files=[("image", make_test_image_bytes((24, 16)))],
|
||||
data={"prompt": "hello world.", "size": "16x24"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
sampling = test_client.app.state.engine_client.captured_sampling_params_list[0]
|
||||
assert (sampling.height, sampling.width) == (24, 16)
|
||||
assert (sampling.height_not_provided, sampling.width_not_provided) == (False, False)
|
||||
|
||||
|
||||
def test_image_edit_response_size_reports_generated_image_single_stage(test_client):
|
||||
response = test_client.post(
|
||||
"/v1/images/edits",
|
||||
files=[("image", make_test_image_bytes((24, 16)))],
|
||||
data={"prompt": "hello world.", "size": "16x24"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["size"] == "64x64"
|
||||
|
||||
|
||||
def test_generate_images_response_size_reports_generated_image(test_client):
|
||||
response = test_client.post(
|
||||
"/v1/images/generations",
|
||||
json={"prompt": "a cat", "n": 1, "size": "1024x1024"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["size"] == "64x64"
|
||||
|
||||
|
||||
def test_image_edit_compression_jpeg(test_client):
|
||||
img_bytes_1 = make_test_image_bytes((16, 16))
|
||||
# uploadfile with image key
|
||||
|
||||
Reference in new issue
Block a user