Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,17 +24,16 @@ def predict(prompt, ip_adapter_image, ip_adapter_scale=0.5, negative_prompt="",
|
|
| 24 |
if randomize_seed:
|
| 25 |
seed = random.randint(0, MAX_SEED)
|
| 26 |
|
|
|
|
| 27 |
if not center_crop:
|
| 28 |
-
ip_adapter_image = [
|
| 29 |
-
else:
|
| 30 |
-
ip_adapter_image = ip_adapter_image[0]
|
| 31 |
|
| 32 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 33 |
pipe.set_ip_adapter_scale([ip_adapter_scale])
|
| 34 |
|
| 35 |
image = pipe(
|
| 36 |
prompt=prompt,
|
| 37 |
-
ip_adapter_image=
|
| 38 |
negative_prompt=negative_prompt,
|
| 39 |
height=height,
|
| 40 |
width=width,
|
|
|
|
| 24 |
if randomize_seed:
|
| 25 |
seed = random.randint(0, MAX_SEED)
|
| 26 |
|
| 27 |
+
# Optionally resize images if center crop is not selected
|
| 28 |
if not center_crop:
|
| 29 |
+
ip_adapter_image = [image.resize((224, 224)) for image in ip_adapter_image]
|
|
|
|
|
|
|
| 30 |
|
| 31 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 32 |
pipe.set_ip_adapter_scale([ip_adapter_scale])
|
| 33 |
|
| 34 |
image = pipe(
|
| 35 |
prompt=prompt,
|
| 36 |
+
ip_adapter_image=ip_adapter_image,
|
| 37 |
negative_prompt=negative_prompt,
|
| 38 |
height=height,
|
| 39 |
width=width,
|