Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,20 +27,20 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
|
|
| 27 |
seed = random.randint(0, MAX_SEED)
|
| 28 |
|
| 29 |
input_image = input_image.convert("RGB")
|
| 30 |
-
|
| 31 |
original_width, original_height = input_image.size
|
| 32 |
|
| 33 |
if original_width >= original_height:
|
| 34 |
new_width = 1024
|
| 35 |
new_height = int(original_height * (new_width / original_width))
|
|
|
|
| 36 |
else:
|
| 37 |
new_height = 1024
|
| 38 |
new_width = int(original_width * (new_height / original_height))
|
|
|
|
| 39 |
|
| 40 |
input_image_resized = input_image.resize((new_width, new_height), Image.LANCZOS)
|
| 41 |
-
|
| 42 |
image = pipe(
|
| 43 |
-
image=input_image_resized,
|
| 44 |
prompt=prompt,
|
| 45 |
guidance_scale=guidance_scale,
|
| 46 |
width=new_width,
|
|
|
|
| 27 |
seed = random.randint(0, MAX_SEED)
|
| 28 |
|
| 29 |
input_image = input_image.convert("RGB")
|
|
|
|
| 30 |
original_width, original_height = input_image.size
|
| 31 |
|
| 32 |
if original_width >= original_height:
|
| 33 |
new_width = 1024
|
| 34 |
new_height = int(original_height * (new_width / original_width))
|
| 35 |
+
new_height = round(new_height / 64) * 64
|
| 36 |
else:
|
| 37 |
new_height = 1024
|
| 38 |
new_width = int(original_width * (new_height / original_height))
|
| 39 |
+
new_width = round(new_width / 64) * 64
|
| 40 |
|
| 41 |
input_image_resized = input_image.resize((new_width, new_height), Image.LANCZOS)
|
|
|
|
| 42 |
image = pipe(
|
| 43 |
+
image=input_image_resized,
|
| 44 |
prompt=prompt,
|
| 45 |
guidance_scale=guidance_scale,
|
| 46 |
width=new_width,
|