Update README.md

#3
by YiYiXu - opened
Files changed (1) hide show
  1. README.md +6 -4
README.md CHANGED
@@ -31,11 +31,13 @@ from diffusers.utils import load_image
31
  import torch
32
  import numpy as np
33
 
34
- pipe_prior = KandinskyPriorPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16)
 
 
35
  pipe_prior.to("cuda")
36
 
37
  prompt = "a hat"
38
- image_emb, zero_image_emb = pipe_prior(prompt, return_dict=False)
39
 
40
  pipe = KandinskyInpaintPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-inpaint", torch_dtype=torch.float16)
41
  pipe.to("cuda")
@@ -45,14 +47,14 @@ init_image = load_image(
45
  )
46
 
47
  mask = np.ones((768, 768), dtype=np.float32)
 
48
  mask[:250, 250:-250] = 0
49
 
50
  out = pipe(
51
  prompt,
52
  image=init_image,
53
  mask_image=mask,
54
- image_embeds=image_emb,
55
- negative_image_embeds=zero_image_emb,
56
  height=768,
57
  width=768,
58
  num_inference_steps=150,
 
31
  import torch
32
  import numpy as np
33
 
34
+ pipe_prior = KandinskyPriorPipeline.from_pretrained(
35
+ "kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16
36
+ )
37
  pipe_prior.to("cuda")
38
 
39
  prompt = "a hat"
40
+ prior_output = pipe_prior(prompt)
41
 
42
  pipe = KandinskyInpaintPipeline.from_pretrained("kandinsky-community/kandinsky-2-1-inpaint", torch_dtype=torch.float16)
43
  pipe.to("cuda")
 
47
  )
48
 
49
  mask = np.ones((768, 768), dtype=np.float32)
50
+ # Let's mask out an area above the cat's head
51
  mask[:250, 250:-250] = 0
52
 
53
  out = pipe(
54
  prompt,
55
  image=init_image,
56
  mask_image=mask,
57
+ **prior_output,
 
58
  height=768,
59
  width=768,
60
  num_inference_steps=150,