Spaces:
Running on Zero
Running on Zero
Fix image2image (#3)
Browse files- Fix image2image (3e9821606f2275eae93ec83262c475ab084a48b7)
Co-authored-by: Face Cool <srface@users.noreply.huggingface.co>
app.py
CHANGED
|
@@ -72,16 +72,14 @@ def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
|
| 72 |
def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height, generator):
|
| 73 |
|
| 74 |
ratio = min(height / img.height, width / img.width)
|
| 75 |
-
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
| 76 |
result = pipe_i2i(
|
| 77 |
prompt,
|
| 78 |
negative_prompt = neg_prompt,
|
| 79 |
-
|
| 80 |
num_inference_steps = int(steps),
|
| 81 |
strength = strength,
|
| 82 |
guidance_scale = guidance,
|
| 83 |
-
width = width,
|
| 84 |
-
height = height,
|
| 85 |
generator = generator)
|
| 86 |
|
| 87 |
return replace_nsfw_images(result)
|
|
|
|
| 72 |
def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height, generator):
|
| 73 |
|
| 74 |
ratio = min(height / img.height, width / img.width)
|
| 75 |
+
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.Resampling.LANCZOS)
|
| 76 |
result = pipe_i2i(
|
| 77 |
prompt,
|
| 78 |
negative_prompt = neg_prompt,
|
| 79 |
+
image = img,
|
| 80 |
num_inference_steps = int(steps),
|
| 81 |
strength = strength,
|
| 82 |
guidance_scale = guidance,
|
|
|
|
|
|
|
| 83 |
generator = generator)
|
| 84 |
|
| 85 |
return replace_nsfw_images(result)
|