Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,11 @@ pipe = StableDiffusion3Pipeline.from_pretrained(
|
|
| 34 |
torch_dtype=torch.bfloat16
|
| 35 |
)
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
def resize_img(image, max_size=1024):
|
| 40 |
width, height = image.size
|
|
@@ -68,13 +72,13 @@ def process_image(
|
|
| 68 |
image = resize_img(image)
|
| 69 |
|
| 70 |
# Generate the image
|
| 71 |
-
result =
|
| 72 |
-
|
| 73 |
prompt=prompt,
|
| 74 |
-
|
| 75 |
width=width,
|
| 76 |
height=height,
|
| 77 |
-
|
| 78 |
)
|
| 79 |
|
| 80 |
return result[0], seed
|
|
|
|
| 34 |
torch_dtype=torch.bfloat16
|
| 35 |
)
|
| 36 |
|
| 37 |
+
pipe.init_ipadapter(
|
| 38 |
+
ip_adapter_path=ip_adapter_path,
|
| 39 |
+
image_encoder_path=image_encoder_path,
|
| 40 |
+
nb_token=64,
|
| 41 |
+
)
|
| 42 |
|
| 43 |
def resize_img(image, max_size=1024):
|
| 44 |
width, height = image.size
|
|
|
|
| 72 |
image = resize_img(image)
|
| 73 |
|
| 74 |
# Generate the image
|
| 75 |
+
result = pipe(
|
| 76 |
+
clip_image=image,
|
| 77 |
prompt=prompt,
|
| 78 |
+
ipadapter_scale=scale,
|
| 79 |
width=width,
|
| 80 |
height=height,
|
| 81 |
+
generator=torch.Generator("cuda").manual_seed(seed)
|
| 82 |
)
|
| 83 |
|
| 84 |
return result[0], seed
|