Update README.md
Browse files
README.md
CHANGED
@@ -33,13 +33,14 @@ text_encoder_2 = T5EncoderModel.from_pretrained(
|
|
33 |
)
|
34 |
pipe.transformer = transformer
|
35 |
pipe.text_encoder_2 = text_encoder_2
|
|
|
36 |
pipe.to("cuda")
|
37 |
|
38 |
-
prompt = "
|
39 |
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png")
|
40 |
|
41 |
-
head_mask = np.
|
42 |
-
head_mask[65:
|
43 |
mask_image = Image.fromarray(head_mask)
|
44 |
|
45 |
processor = DepthPreprocessor.from_pretrained("LiheYoung/depth-anything-large-hf")
|
@@ -50,14 +51,11 @@ output = pipe(
|
|
50 |
image=image,
|
51 |
control_image=control_image,
|
52 |
mask_image=mask_image,
|
53 |
-
height=1024,
|
54 |
-
width=1024,
|
55 |
num_inference_steps=30,
|
56 |
strength=0.9,
|
57 |
-
guidance_scale=
|
58 |
generator=torch.Generator().manual_seed(42),
|
59 |
).images[0]
|
60 |
-
make_image_grid([image, control_image, mask_image, output], rows=1, cols=4).save("output.png")
|
61 |
-
|
62 |
```
|
63 |
-
|
|
|
33 |
)
|
34 |
pipe.transformer = transformer
|
35 |
pipe.text_encoder_2 = text_encoder_2
|
36 |
+
pipe.enable_model_cpu_offload()
|
37 |
pipe.to("cuda")
|
38 |
|
39 |
+
prompt = "a blue robot singing opera with human-like expressions"
|
40 |
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png")
|
41 |
|
42 |
+
head_mask = np.zeros_like(image)
|
43 |
+
head_mask[65:580,300:642] = 255
|
44 |
mask_image = Image.fromarray(head_mask)
|
45 |
|
46 |
processor = DepthPreprocessor.from_pretrained("LiheYoung/depth-anything-large-hf")
|
|
|
51 |
image=image,
|
52 |
control_image=control_image,
|
53 |
mask_image=mask_image,
|
|
|
|
|
54 |
num_inference_steps=30,
|
55 |
strength=0.9,
|
56 |
+
guidance_scale=50.0,
|
57 |
generator=torch.Generator().manual_seed(42),
|
58 |
).images[0]
|
59 |
+
make_image_grid([image, control_image, mask_image, output.resize(image.size)], rows=1, cols=4).save("output.png")
|
|
|
60 |
```
|
61 |
+
![](output.png)
|