import{s as Kl,o as Ll,n as W}from"../chunks/scheduler.182ea377.js";import{S as Pl,i as Dl,g,s as o,r as d,A as Al,h as w,f as i,c,j as ql,u as y,x as Z,k as G,y as Ol,a as p,v as u,d as f,t as M,w as h}from"../chunks/index.1ea56653.js";import{H as _,g as en}from"../chunks/Heading.71ac6e9f.js";import{T as Ss}from"../chunks/Tip.67abc998.js";import{C as $}from"../chunks/CodeBlock.82c2494b.js";import{D as tn}from"../chunks/DocNotebookDropdown.b1496a40.js";import{H as V,a as j}from"../chunks/HfOption.ca92956a.js";function sn(b){let s,r="Kandinsky 2.1 and 2.2 usage is very similar! The only difference is Kandinsky 2.2 doesn’t accept <code>prompt</code> as an input when decoding the latents. Instead, Kandinsky 2.2 only accepts <code>image_embeds</code> during decoding.";return{c(){s=g("p"),s.innerHTML=r},l(t){s=w(t,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-enep6a"&&(s.innerHTML=r)},m(t,m){p(t,s,m)},p:W,d(t){t&&i(s)}}}function ln(b){let s,r,t,m='Now pass all the prompts and embeddings to the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline">KandinskyPipeline</a> to generate an image:',l,n,J,U,I='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/cheeseburger.png"/>',B;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwYWxpZW4lMjBjaGVlc2VidXJnZXIlMjBjcmVhdHVyZSUyMGVhdGluZyUyMGl0c2VsZiUyQyUyMGNsYXltYXRpb24lMkMlMjBjaW5lbWF0aWMlMkMlMjBtb29keSUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMjAlMjMlMjBvcHRpb25hbCUyMHRvJTIwaW5jbHVkZSUyMGElMjBuZWdhdGl2ZSUyMHByb21wdCUyQyUyMGJ1dCUyMHJlc3VsdHMlMjBhcmUlMjB1c3VhbGx5JTIwYmV0dGVyJTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxLjApLnRvX3R1cGxlKCk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPriorPipeline, KandinskyPipeline
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span> <span class="hljs-comment"># optional to include a negative prompt, but results are usually better</span>
image_embeds, negative_image_embeds = prior_pipeline(prompt, negative_prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`,wrap:!1}}),n=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RA==",highlighted:'image = pipeline(prompt, image_embeds=image_embeds, negative_prompt=negative_prompt, negative_image_embeds=negative_image_embeds, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("p"),t.innerHTML=m,l=o(),d(n.$$.fragment),J=o(),U=g("div"),U.innerHTML=I,this.h()},l(k){y(s.$$.fragment,k),r=c(k),t=w(k,"P",{"data-svelte-h":!0}),Z(t)!=="svelte-fnb5ou"&&(t.innerHTML=m),l=c(k),y(n.$$.fragment,k),J=c(k),U=w(k,"DIV",{class:!0,"data-svelte-h":!0}),Z(U)!=="svelte-i75i2v"&&(U.innerHTML=I),this.h()},h(){G(U,"class","flex justify-center")},m(k,T){u(s,k,T),p(k,r,T),p(k,t,T),p(k,l,T),u(n,k,T),p(k,J,T),p(k,U,T),B=!0},p:W,i(k){B||(f(s.$$.fragment,k),f(n.$$.fragment,k),B=!0)},o(k){M(s.$$.fragment,k),M(n.$$.fragment,k),B=!1},d(k){k&&(i(r),i(t),i(l),i(J),i(U)),h(s,k),h(n,k)}}}function nn(b){let s,r,t,m='Pass the <code>image_embeds</code> and <code>negative_image_embeds</code> to the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22Pipeline">KandinskyV22Pipeline</a> to generate an image:',l,n,J,U,I='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-text-to-image.png"/>',B;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBhbGllbiUyMGNoZWVzZWJ1cmdlciUyMGNyZWF0dXJlJTIwZWF0aW5nJTIwaXRzZWxmJTJDJTIwY2xheW1hdGlvbiUyQyUyMGNpbmVtYXRpYyUyQyUyMG1vb2R5JTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUyMCUyMyUyMG9wdGlvbmFsJTIwdG8lMjBpbmNsdWRlJTIwYSUyMG5lZ2F0aXZlJTIwcHJvbXB0JTJDJTIwYnV0JTIwcmVzdWx0cyUyMGFyZSUyMHVzdWFsbHklMjBiZXR0ZXIlMEFpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMjAlM0QlMjBwcmlvcl9waXBlbGluZShwcm9tcHQlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCkudG9fdHVwbGUoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22Pipeline
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyV22Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span> <span class="hljs-comment"># optional to include a negative prompt, but results are usually better</span>
image_embeds, negative_image_embeds = prior_pipeline(prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`,wrap:!1}}),n=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RA==",highlighted:'image = pipeline(image_embeds=image_embeds, negative_image_embeds=negative_image_embeds, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("p"),t.innerHTML=m,l=o(),d(n.$$.fragment),J=o(),U=g("div"),U.innerHTML=I,this.h()},l(k){y(s.$$.fragment,k),r=c(k),t=w(k,"P",{"data-svelte-h":!0}),Z(t)!=="svelte-h1vaih"&&(t.innerHTML=m),l=c(k),y(n.$$.fragment,k),J=c(k),U=w(k,"DIV",{class:!0,"data-svelte-h":!0}),Z(U)!=="svelte-kkab9k"&&(U.innerHTML=I),this.h()},h(){G(U,"class","flex justify-center")},m(k,T){u(s,k,T),p(k,r,T),p(k,t,T),p(k,l,T),u(n,k,T),p(k,J,T),p(k,U,T),B=!0},p:W,i(k){B||(f(s.$$.fragment,k),f(n.$$.fragment,k),B=!0)},o(k){M(s.$$.fragment,k),M(n.$$.fragment,k),B=!1},d(k){k&&(i(r),i(t),i(l),i(J),i(U)),h(s,k),h(n,k)}}}function an(b){let s,r,t,m;return s=new j({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[ln]},$$scope:{ctx:b}}}),t=new j({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[nn]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function pn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwYWxpZW4lMjBjaGVlc2VidXJnZXIlMjBjcmVhdHVyZSUyMGVhdGluZyUyMGl0c2VsZiUyQyUyMGNsYXltYXRpb24lMkMlMjBjaW5lbWF0aWMlMkMlMjBtb29keSUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUyMHByaW9yX2d1aWRhbmNlX3NjYWxlJTNEMS4wJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlMjAlM0QlMjA0LjAlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

image = pipeline(prompt=prompt, negative_prompt=negative_prompt, prior_guidance_scale=<span class="hljs-number">1.0</span>, guidance_scale = <span class="hljs-number">4.0</span>, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function rn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItZGVjb2RlciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBhbGllbiUyMGNoZWVzZWJ1cmdlciUyMGNyZWF0dXJlJTIwZWF0aW5nJTIwaXRzZWxmJTJDJTIwY2xheW1hdGlvbiUyQyUyMGNpbmVtYXRpYyUyQyUyMG1vb2R5JTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwcHJpb3JfZ3VpZGFuY2Vfc2NhbGUlM0QxLjAlMkMlMjBndWlkYW5jZV9zY2FsZSUyMCUzRCUyMDQuMCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

image = pipeline(prompt=prompt, negative_prompt=negative_prompt, prior_guidance_scale=<span class="hljs-number">1.0</span>, guidance_scale = <span class="hljs-number">4.0</span>, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function mn(b){let s,r,t,m;return s=new j({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[pn]},$$scope:{ctx:b}}}),t=new j({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[rn]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function on(b){let s,r;return s=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5SW1nMkltZ1BpcGVsaW5lJTJDJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZSUwQSUwQXByaW9yX3BpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTEtcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5SW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyImg2ImgPipeline, KandinskyPriorPipeline

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyImg2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function cn(b){let s,r;return s=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIySW1nMkltZ1BpcGVsaW5lJTJDJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZSUwQSUwQXByaW9yX3BpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIySW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22Img2ImgPipeline, KandinskyPriorPipeline

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyV22Img2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function dn(b){let s,r,t,m;return s=new j({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[on]},$$scope:{ctx:b}}}),t=new j({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[cn]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function yn(b){let s,r,t,m='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/img2img_fantasyland.png"/>',l;return s=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTIwaW1hZ2VfZW1iZWRzJTNEaW1hZ2VfZW1lYmRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTNEbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjglMkMlMjBzdHJlbmd0aCUzRDAuMykuaW1hZ2VzJTVCMCU1RA==",highlighted:'image = pipeline(prompt, negative_prompt=negative_prompt, image=original_image, image_embeds=image_emebds, negative_image_embeds=negative_image_embeds, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("div"),t.innerHTML=m,this.h()},l(n){y(s.$$.fragment,n),r=c(n),t=w(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(t)!=="svelte-1vh4dwd"&&(t.innerHTML=m),this.h()},h(){G(t,"class","flex justify-center")},m(n,J){u(s,n,J),p(n,r,J),p(n,t,J),l=!0},p:W,i(n){l||(f(s.$$.fragment,n),l=!0)},o(n){M(s.$$.fragment,n),l=!1},d(n){n&&(i(r),i(t)),h(s,n)}}}function un(b){let s,r,t,m='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-image-to-image.png"/>',l;return s=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTIwaW1hZ2VfZW1iZWRzJTNEaW1hZ2VfZW1lYmRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTNEbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjglMkMlMjBzdHJlbmd0aCUzRDAuMykuaW1hZ2VzJTVCMCU1RA==",highlighted:'image = pipeline(image=original_image, image_embeds=image_emebds, negative_image_embeds=negative_image_embeds, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("div"),t.innerHTML=m,this.h()},l(n){y(s.$$.fragment,n),r=c(n),t=w(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(t)!=="svelte-1vux4a0"&&(t.innerHTML=m),this.h()},h(){G(t,"class","flex justify-center")},m(n,J){u(s,n,J),p(n,r,J),p(n,t,J),l=!0},p:W,i(n){l||(f(s.$$.fragment,n),l=!0)},o(n){M(s.$$.fragment,n),l=!1},d(n){n&&(i(r),i(t)),h(s,n)}}}function fn(b){let s,r,t,m;return s=new j({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[yn]},$$scope:{ctx:b}}}),t=new j({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[un]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function Mn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjBvcyUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBmYW50YXN5JTIwbGFuZHNjYXBlJTJDJTIwQ2luZW1hdGljJTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZS50aHVtYm5haWwoKDc2OCUyQyUyMDc2OCkpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> os

pipeline = AutoPipelineForImage2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)
pipeline.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;A fantasy landscape, Cinematic lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>

response = requests.get(url)
original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
original_image.thumbnail((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

image = pipeline(prompt=prompt, image=original_image, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function hn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBaW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjBvcyUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwZmFudGFzeSUyMGxhbmRzY2FwZSUyQyUyMENpbmVtYXRpYyUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbiUyRm1haW4lMkZhc3NldHMlMkZzdGFibGUtc2FtcGxlcyUyRmltZzJpbWclMkZza2V0Y2gtbW91bnRhaW5zLWlucHV0LmpwZyUyMiUwQSUwQXJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4oQnl0ZXNJTyhyZXNwb25zZS5jb250ZW50KSkuY29udmVydCglMjJSR0IlMjIpJTBBb3JpZ2luYWxfaW1hZ2UudGh1bWJuYWlsKCg3NjglMkMlMjA3NjgpKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMHN0cmVuZ3RoJTNEMC4zKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> os

pipeline = AutoPipelineForImage2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;A fantasy landscape, Cinematic lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>

response = requests.get(url)
original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
original_image.thumbnail((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

image = pipeline(prompt=prompt, image=original_image, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function Jn(b){let s,r,t,m;return s=new j({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[Mn]},$$scope:{ctx:b}}}),t=new j({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[hn]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function bn(b){let s,r='⚠️ The Kandinsky models uses ⬜️ <strong>white pixels</strong> to represent the masked area now instead of black pixels. If you are using <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline">KandinskyInpaintPipeline</a> in production, you need to change the mask to use white pixels:',t,m,l;return m=new $({props:{code:"JTIzJTIwRm9yJTIwUElMJTIwaW5wdXQlMEFpbXBvcnQlMjBQSUwuSW1hZ2VPcHMlMEFtYXNrJTIwJTNEJTIwUElMLkltYWdlT3BzLmludmVydChtYXNrKSUwQSUwQSUyMyUyMEZvciUyMFB5VG9yY2glMjBhbmQlMjBOdW1QeSUyMGlucHV0JTBBbWFzayUyMCUzRCUyMDElMjAtJTIwbWFzaw==",highlighted:`<span class="hljs-comment"># For PIL input</span>
<span class="hljs-keyword">import</span> PIL.ImageOps
mask = PIL.ImageOps.invert(mask)

<span class="hljs-comment"># For PyTorch and NumPy input</span>
mask = <span class="hljs-number">1</span> - mask`,wrap:!1}}),{c(){s=g("p"),s.innerHTML=r,t=o(),d(m.$$.fragment)},l(n){s=w(n,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-4ma7wz"&&(s.innerHTML=r),t=c(n),y(m.$$.fragment,n)},m(n,J){p(n,s,J),p(n,t,J),u(m,n,J),l=!0},p:W,i(n){l||(f(m.$$.fragment,n),l=!0)},o(n){M(m.$$.fragment,n),l=!1},d(n){n&&(i(s),i(t)),h(m,n)}}}function gn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLWlucGFpbnQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyInpaintPipeline, KandinskyPriorPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyInpaintPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-inpaint&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function wn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMklucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXItaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22InpaintPipeline, KandinskyV22PriorPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyV22InpaintPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder-inpaint&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function Zn(b){let s,r,t,m;return s=new j({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[gn]},$$scope:{ctx:b}}}),t=new j({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[wn]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function kn(b){let s,r,t,m='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/inpaint_cat_hat.png"/>',l;return s=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBpbWFnZSUzRGluaXRfaW1hZ2UlMkMlMjBtYXNrX2ltYWdlJTNEbWFzayUyQyUyMCoqcHJpb3Jfb3V0cHV0JTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjglMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTUwKS5pbWFnZXMlNUIwJTVE",highlighted:'image = pipeline(prompt, image=init_image, mask_image=mask, **prior_output, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>, num_inference_steps=<span class="hljs-number">150</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("div"),t.innerHTML=m,this.h()},l(n){y(s.$$.fragment,n),r=c(n),t=w(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(t)!=="svelte-1d04i1f"&&(t.innerHTML=m),this.h()},h(){G(t,"class","flex justify-center")},m(n,J){u(s,n,J),p(n,r,J),p(n,t,J),l=!0},p:W,i(n){l||(f(s.$$.fragment,n),l=!0)},o(n){M(s.$$.fragment,n),l=!1},d(n){n&&(i(r),i(t)),h(s,n)}}}function Un(b){let s,r,t,m='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinskyv22-inpaint.png"/>',l;return s=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZSUzRGluaXRfaW1hZ2UlMkMlMjBtYXNrX2ltYWdlJTNEbWFzayUyQyUyMCoqcHJpb3Jfb3V0cHV0JTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjglMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTUwKS5pbWFnZXMlNUIwJTVE",highlighted:'image = pipeline(image=init_image, mask_image=mask, **prior_output, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>, num_inference_steps=<span class="hljs-number">150</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("div"),t.innerHTML=m,this.h()},l(n){y(s.$$.fragment,n),r=c(n),t=w(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(t)!=="svelte-1ajezuw"&&(t.innerHTML=m),this.h()},h(){G(t,"class","flex justify-center")},m(n,J){u(s,n,J),p(n,r,J),p(n,t,J),l=!0},p:W,i(n){l||(f(s.$$.fragment,n),l=!0)},o(n){M(s.$$.fragment,n),l=!1},d(n){n&&(i(r),i(t)),h(s,n)}}}function $n(b){let s,r,t,m;return s=new j({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[kn]},$$scope:{ctx:b}}}),t=new j({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Un]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function Tn(b){let s,r;return s=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUwQSUwQXBpcGUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JJbnBhaW50aW5nLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1pbnBhaW50JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwaGF0JTIyJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMjBtYXNrX2ltYWdlJTNEbWFzaykuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting

pipe = AutoPipelineForInpainting.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-inpaint&quot;</span>, torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;a hat&quot;</span>

image = pipe(prompt=prompt, image=original_image, mask_image=mask).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function Wn(b){let s,r;return s=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUwQSUwQXBpcGUlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JJbnBhaW50aW5nLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyLWlucGFpbnQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBoYXQlMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMG1hc2tfaW1hZ2UlM0RtYXNrKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting

pipe = AutoPipelineForInpainting.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder-inpaint&quot;</span>, torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;a hat&quot;</span>

image = pipe(prompt=prompt, image=original_image, mask_image=mask).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function jn(b){let s,r,t,m;return s=new j({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[Tn]},$$scope:{ctx:b}}}),t=new j({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Wn]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function Gn(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBaW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWdfMSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBaW1nXzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZzdGFycnlfbmlnaHQuanBlZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPriorPipeline, KandinskyPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> PIL
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
img_1 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
img_2 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/starry_night.jpeg&quot;</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function In(b){let s,r;return s=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBaW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWdfMSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBaW1nXzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZzdGFycnlfbmlnaHQuanBlZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22Pipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> PIL
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
img_1 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
img_2 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/starry_night.jpeg&quot;</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(t){y(s.$$.fragment,t)},m(t,m){u(s,t,m),r=!0},p:W,i(t){r||(f(s.$$.fragment,t),r=!0)},o(t){M(s.$$.fragment,t),r=!1},d(t){h(s,t)}}}function Bn(b){let s,r,t,m;return s=new j({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Gn]},$$scope:{ctx:b}}}),t=new j({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[In]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function Vn(b){let s,r,t,m='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/starry_cat.png"/>',l;return s=new $({props:{code:"JTIzJTIwcHJvbXB0JTIwY2FuJTIwYmUlMjBsZWZ0JTIwZW1wdHklMEFwcm9tcHQlMjAlM0QlMjAlMjIlMjIlMEFwcmlvcl9vdXQlMjAlM0QlMjBwcmlvcl9waXBlbGluZS5pbnRlcnBvbGF0ZShpbWFnZXNfdGV4dHMlMkMlMjB3ZWlnaHRzKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMCoqcHJpb3Jfb3V0JTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjgpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-comment"># prompt can be left empty</span>
prompt = <span class="hljs-string">&quot;&quot;</span>
prior_out = prior_pipeline.interpolate(images_texts, weights)

pipeline = KandinskyPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipeline(prompt, **prior_out, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("div"),t.innerHTML=m,this.h()},l(n){y(s.$$.fragment,n),r=c(n),t=w(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(t)!=="svelte-twgci5"&&(t.innerHTML=m),this.h()},h(){G(t,"class","flex justify-center")},m(n,J){u(s,n,J),p(n,r,J),p(n,t,J),l=!0},p:W,i(n){l||(f(s.$$.fragment,n),l=!0)},o(n){M(s.$$.fragment,n),l=!1},d(n){n&&(i(r),i(t)),h(s,n)}}}function _n(b){let s,r,t,m='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinskyv22-interpolate.png"/>',l;return s=new $({props:{code:"JTIzJTIwcHJvbXB0JTIwY2FuJTIwYmUlMjBsZWZ0JTIwZW1wdHklMEFwcm9tcHQlMjAlM0QlMjAlMjIlMjIlMEFwcmlvcl9vdXQlMjAlM0QlMjBwcmlvcl9waXBlbGluZS5pbnRlcnBvbGF0ZShpbWFnZXNfdGV4dHMlMkMlMjB3ZWlnaHRzKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIyUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwKipwcmlvcl9vdXQlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`<span class="hljs-comment"># prompt can be left empty</span>
prompt = <span class="hljs-string">&quot;&quot;</span>
prior_out = prior_pipeline.interpolate(images_texts, weights)

pipeline = KandinskyV22Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipeline(prompt, **prior_out, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){d(s.$$.fragment),r=o(),t=g("div"),t.innerHTML=m,this.h()},l(n){y(s.$$.fragment,n),r=c(n),t=w(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(t)!=="svelte-2ur4ou"&&(t.innerHTML=m),this.h()},h(){G(t,"class","flex justify-center")},m(n,J){u(s,n,J),p(n,r,J),p(n,t,J),l=!0},p:W,i(n){l||(f(s.$$.fragment,n),l=!0)},o(n){M(s.$$.fragment,n),l=!1},d(n){n&&(i(r),i(t)),h(s,n)}}}function Rn(b){let s,r,t,m;return s=new j({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Vn]},$$scope:{ctx:b}}}),t=new j({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[_n]},$$scope:{ctx:b}}}),{c(){d(s.$$.fragment),r=o(),d(t.$$.fragment)},l(l){y(s.$$.fragment,l),r=c(l),y(t.$$.fragment,l)},m(l,n){u(s,l,n),p(l,r,n),u(t,l,n),m=!0},p(l,n){const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J);const U={};n&2&&(U.$$scope={dirty:n,ctx:l}),t.$set(U)},i(l){m||(f(s.$$.fragment,l),f(t.$$.fragment,l),m=!0)},o(l){M(s.$$.fragment,l),M(t.$$.fragment,l),m=!1},d(l){l&&i(r),h(s,l),h(t,l)}}}function vn(b){let s,r="⚠️ ControlNet is only supported for Kandinsky 2.2!";return{c(){s=g("p"),s.textContent=r},l(t){s=w(t,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-ms5sxh"&&(s.textContent=r)},m(t,m){p(t,s,m)},p:W,d(t){t&&i(s)}}}function Xn(b){let s,r,t,m,l,n,J,U,I,B="The Kandinsky models are a series of multilingual text-to-image generation models. The Kandinsky 2.0 model uses two multilingual text encoders and concatenates those results for the UNet.",k,T,zs='<a href="../api/pipelines/kandinsky">Kandinsky 2.1</a> changes the architecture to include an image prior model (<a href="https://huggingface.co/docs/transformers/model_doc/clip" rel="nofollow"><code>CLIP</code></a>) to generate a mapping between text and image embeddings. The mapping provides better text-image alignment and it is used with the text embeddings during training, leading to higher quality results. Finally, Kandinsky 2.1 uses a <a href="https://huggingface.co/papers/2209.09002" rel="nofollow">Modulating Quantized Vectors (MoVQ)</a> decoder - which adds a spatial conditional normalization layer to increase photorealism - to decode the latents into images.',ct,te,xs='<a href="../api/pipelines/kandinsky_v22">Kandinsky 2.2</a> improves on the previous model by replacing the image encoder of the image prior model with a larger CLIP-ViT-G model to improve quality. The image prior model was also retrained on images with different resolutions and aspect ratios to generate higher-resolution images and different image sizes.',dt,se,Es="This guide will show you how to use the Kandinsky models for text-to-image, image-to-image, inpainting, interpolation, and more.",yt,le,qs="Before you begin, make sure you have the following libraries installed:",ut,ne,ft,R,Mt,ae,ht,ie,Ks="To use the Kandinsky models for any task, you always start by setting up the prior pipeline to encode the prompt and generate the image embeddings. The prior pipeline also generates <code>negative_image_embeds</code> that correspond to the negative prompt <code>&quot;&quot;</code>. For better results, you can pass an actual <code>negative_prompt</code> to the prior pipeline, but this’ll increase the effective batch size of the prior pipeline by 2x.",Jt,v,bt,pe,Ls='🤗 Diffusers also provides an end-to-end API with the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyCombinedPipeline">KandinskyCombinedPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22CombinedPipeline">KandinskyV22CombinedPipeline</a>, meaning you don’t have to separately load the prior and text-to-image pipeline. The combined pipeline automatically loads both the prior model and the decoder. You can still set different values for the prior pipeline with the <code>prior_guidance_scale</code> and <code>prior_num_inference_steps</code> parameters if you want.',gt,re,Ps='Use the <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForText2Image">AutoPipelineForText2Image</a> to automatically call the combined pipelines under the hood:',wt,X,Zt,me,kt,oe,Ds="For image-to-image, pass the initial image and text prompt to condition the image with to the pipeline. Start by loading the prior pipeline:",Ut,C,$t,ce,As="Download an image to condition on:",Tt,de,Wt,H,Os='<img class="rounded-xl" src="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"/>',jt,ye,el="Generate the <code>image_embeds</code> and <code>negative_image_embeds</code> with the prior pipeline:",Gt,ue,It,fe,tl="Now pass the original image, and all the prompts and embeddings to the pipeline to generate an image:",Bt,Q,Vt,Me,sl='🤗 Diffusers also provides an end-to-end API with the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgCombinedPipeline">KandinskyImg2ImgCombinedPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22Img2ImgCombinedPipeline">KandinskyV22Img2ImgCombinedPipeline</a>, meaning you don’t have to separately load the prior and image-to-image pipeline. The combined pipeline automatically loads both the prior model and the decoder. You can still set different values for the prior pipeline with the <code>prior_guidance_scale</code> and <code>prior_num_inference_steps</code> parameters if you want.',_t,he,ll='Use the <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForImage2Image">AutoPipelineForImage2Image</a> to automatically call the combined pipelines under the hood:',Rt,Y,vt,Je,Xt,F,Ct,be,nl="For inpainting, you’ll need the original image, a mask of the area to replace in the original image, and a text prompt of what to inpaint. Load the prior pipeline:",Ht,N,Qt,ge,al="Load an initial image and create a mask:",Yt,we,Ft,Ze,il="Generate the embeddings with the prior pipeline:",Nt,ke,St,Ue,pl="Now pass the initial image, mask, and prompt and embeddings to the pipeline to generate an image:",zt,S,xt,$e,rl='You can also use the end-to-end <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintCombinedPipeline">KandinskyInpaintCombinedPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22InpaintCombinedPipeline">KandinskyV22InpaintCombinedPipeline</a> to call the prior and decoder pipelines together under the hood. Use the <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForInpainting">AutoPipelineForInpainting</a> for this:',Et,z,qt,Te,Kt,We,ml="Interpolation allows you to explore the latent space between the image and text embeddings which is a cool way to see some of the prior model’s intermediate outputs. Load the prior pipeline and two images you’d like to interpolate:",Lt,x,Pt,E,ol='<div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">a cat</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/starry_night.jpeg"/> <figcaption class="mt-2 text-center text-sm text-gray-500">Van Gogh&#39;s Starry Night painting</figcaption></div>',Dt,je,cl="Specify the text or images to interpolate, and set the weights for each text or image. Experiment with the weights to see how they affect the interpolation!",At,Ge,Ot,Ie,dl="Call the <code>interpolate</code> function to generate the embeddings, and then pass them to the pipeline to generate the image:",es,q,ts,Be,ss,K,ls,Ve,yl="ControlNet enables conditioning large pretrained diffusion models with additional inputs such as a depth map or edge detection. For example, you can condition Kandinsky 2.2 with a depth map so the model understands and preserves the structure of the depth image.",ns,_e,ul="Let’s load an image and extract it’s depth map:",as,Re,is,L,fl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png"/>',ps,ve,Ml='Then you can use the <code>depth-estimation</code> <a href="https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline" rel="nofollow">Pipeline</a> from 🤗 Transformers to process the image and retrieve the depth map:',rs,Xe,ms,Ce,os,He,hl='Load the prior pipeline and the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetPipeline">KandinskyV22ControlnetPipeline</a>:',cs,Qe,ds,Ye,Jl="Generate the image embeddings from a prompt and negative prompt:",ys,Fe,us,Ne,bl='Finally, pass the image embeddings and the depth image to the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetPipeline">KandinskyV22ControlnetPipeline</a> to generate an image:',fs,Se,Ms,P,gl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat_text2img.png"/>',hs,ze,Js,xe,wl="For image-to-image with ControlNet, you’ll need to use the:",bs,Ee,Zl='<li><a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22PriorEmb2EmbPipeline">KandinskyV22PriorEmb2EmbPipeline</a> to generate the image embeddings from a text prompt and an image</li> <li><a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a> to generate an image from the initial image and the image embeddings</li>',gs,qe,kl='Process and extract a depth map of an initial image of a cat with the <code>depth-estimation</code> <a href="https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline" rel="nofollow">Pipeline</a> from 🤗 Transformers:',ws,Ke,Zs,Le,Ul='Load the prior pipeline and the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a>:',ks,Pe,Us,De,$l="Pass a text prompt and the initial image to the prior pipeline to generate the image embeddings:",$s,Ae,Ts,Oe,Tl='Now you can run the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a> to generate an image from the initial image and the image embeddings:',Ws,et,js,D,Wl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat.png"/>',Gs,tt,Is,st,jl="Kandinsky is unique because it requires a prior pipeline to generate the mappings, and a second pipeline to decode the latents into an image. Optimization efforts should be focused on the second pipeline because that is where the bulk of the computation is done. Here are some tips to improve Kandinsky during inference.",Bs,lt,Gl='<li>Enable <a href="https://moon-ci-docs.huggingface.co/optimization/xformers" rel="nofollow">xFormers</a> if you’re using PyTorch &lt; 2.0:</li>',Vs,nt,_s,A,Il="<li>Enable <code>torch.compile</code> if you’re using PyTorch 2.0 to automatically use scaled dot-product attention (SDPA):</li>",Rs,at,vs,it,Bl='This is the same as explicitly setting the attention processor to use <a href="/docs/diffusers/main/en/api/attnprocessor#diffusers.models.attention_processor.AttnAddedKVProcessor2_0">AttnAddedKVProcessor2_0</a>:',Xs,pt,Cs,O,Vl='<li>Offload the model to the CPU with <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/gligen#diffusers.StableDiffusionGLIGENTextImagePipeline.enable_model_cpu_offload">enable_model_cpu_offload()</a> to avoid out-of-memory errors:</li>',Hs,rt,Qs,ee,_l='<li>By default, the text-to-image pipeline uses the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> but you can replace it with another scheduler like <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a> to see how that affects the tradeoff between inference speed and image quality:</li>',Ys,mt,Fs,ot,Ns;return l=new _({props:{title:"Kandinsky",local:"kandinsky",headingTag:"h1"}}),J=new tn({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/kandinsky.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/kandinsky.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/kandinsky.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/kandinsky.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/kandinsky.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/kandinsky.ipynb"}]}}),ne=new $({props:{code:"JTIzJTIwdW5jb21tZW50JTIwdG8lMjBpbnN0YWxsJTIwdGhlJTIwbmVjZXNzYXJ5JTIwbGlicmFyaWVzJTIwaW4lMjBDb2xhYiUwQSUyMyFwaXAlMjBpbnN0YWxsJTIwdHJhbnNmb3JtZXJzJTIwYWNjZWxlcmF0ZSUyMHNhZmV0ZW5zb3Jz",highlighted:`<span class="hljs-comment"># uncomment to install the necessary libraries in Colab</span>
<span class="hljs-comment">#!pip install transformers accelerate safetensors</span>`,wrap:!1}}),R=new Ss({props:{warning:!0,$$slots:{default:[sn]},$$scope:{ctx:b}}}),ae=new _({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h2"}}),v=new V({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[an]},$$scope:{ctx:b}}}),X=new V({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[mn]},$$scope:{ctx:b}}}),me=new _({props:{title:"Image-to-image",local:"image-to-image",headingTag:"h2"}}),C=new V({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[dn]},$$scope:{ctx:b}}}),de=new $({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBJTBBJTIzJTIwZG93bmxvYWQlMjBpbWFnZSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbmFsX2ltYWdlLnJlc2l6ZSgoNzY4JTJDJTIwNTEyKSk=",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-comment"># download image</span>
url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
response = requests.get(url)
original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))`,wrap:!1}}),ue=new $({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGZhbnRhc3klMjBsYW5kc2NhcGUlMkMlMjBDaW5lbWF0aWMlMjBsaWdodGluZyUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMmxvdyUyMHF1YWxpdHklMkMlMjBiYWQlMjBxdWFsaXR5JTIyJTBBJTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0KS50b190dXBsZSgp",highlighted:`prompt = <span class="hljs-string">&quot;A fantasy landscape, Cinematic lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

image_embeds, negative_image_embeds = prior_pipeline(prompt, negative_prompt).to_tuple()`,wrap:!1}}),Q=new V({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[fn]},$$scope:{ctx:b}}}),Y=new V({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Jn]},$$scope:{ctx:b}}}),Je=new _({props:{title:"Inpainting",local:"inpainting",headingTag:"h2"}}),F=new Ss({props:{warning:!0,$$slots:{default:[bn]},$$scope:{ctx:b}}}),N=new V({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Zn]},$$scope:{ctx:b}}}),we=new $({props:{code:"aW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBbWFzayUyMCUzRCUyMG5wLnplcm9zKCg3NjglMkMlMjA3NjgpJTJDJTIwZHR5cGUlM0RucC5mbG9hdDMyKSUwQSUyMyUyMG1hc2slMjBhcmVhJTIwYWJvdmUlMjBjYXQncyUyMGhlYWQlMEFtYXNrJTVCJTNBMjUwJTJDJTIwMjUwJTNBLTI1MCU1RCUyMCUzRCUyMDE=",highlighted:`init_image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
mask = np.zeros((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>), dtype=np.float32)
<span class="hljs-comment"># mask area above cat&#x27;s head</span>
mask[:<span class="hljs-number">250</span>, <span class="hljs-number">250</span>:-<span class="hljs-number">250</span>] = <span class="hljs-number">1</span>`,wrap:!1}}),ke=new $({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYSUyMGhhdCUyMiUwQXByaW9yX291dHB1dCUyMCUzRCUyMHByaW9yX3BpcGVsaW5lKHByb21wdCk=",highlighted:`prompt = <span class="hljs-string">&quot;a hat&quot;</span>
prior_output = prior_pipeline(prompt)`,wrap:!1}}),S=new V({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[$n]},$$scope:{ctx:b}}}),z=new V({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[jn]},$$scope:{ctx:b}}}),Te=new _({props:{title:"Interpolation",local:"interpolation",headingTag:"h2"}}),x=new V({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Bn]},$$scope:{ctx:b}}}),Ge=new $({props:{code:"aW1hZ2VzX3RleHRzJTIwJTNEJTIwJTVCJTIyYSUyMGNhdCUyMiUyQyUyMGltZzElMkMlMjBpbWcyJTVEJTBBd2VpZ2h0cyUyMCUzRCUyMCU1QjAuMyUyQyUyMDAuMyUyQyUyMDAuNCU1RA==",highlighted:`images_texts = [<span class="hljs-string">&quot;a cat&quot;</span>, img1, img2]
weights = [<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.4</span>]`,wrap:!1}}),q=new V({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Rn]},$$scope:{ctx:b}}}),Be=new _({props:{title:"ControlNet",local:"controlnet",headingTag:"h2"}}),K=new Ss({props:{warning:!0,$$slots:{default:[vn]},$$scope:{ctx:b}}}),Re=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkp",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

img = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png&quot;</span>
).resize((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))`,wrap:!1}}),Xe=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQSUwQWRlZiUyMG1ha2VfaGludChpbWFnZSUyQyUyMGRlcHRoX2VzdGltYXRvciklM0ElMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMGRlcHRoX2VzdGltYXRvcihpbWFnZSklNUIlMjJkZXB0aCUyMiU1RCUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwbnAuYXJyYXkoaW1hZ2UpJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBpbWFnZSU1QiUzQSUyQyUyMCUzQSUyQyUyME5vbmUlNUQlMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMG5wLmNvbmNhdGVuYXRlKCU1QmltYWdlJTJDJTIwaW1hZ2UlMkMlMjBpbWFnZSU1RCUyQyUyMGF4aXMlM0QyKSUwQSUyMCUyMCUyMCUyMGRldGVjdGVkX21hcCUyMCUzRCUyMHRvcmNoLmZyb21fbnVtcHkoaW1hZ2UpLmZsb2F0KCklMjAlMkYlMjAyNTUuMCUwQSUyMCUyMCUyMCUyMGhpbnQlMjAlM0QlMjBkZXRlY3RlZF9tYXAucGVybXV0ZSgyJTJDJTIwMCUyQyUyMDEpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwaGludCUwQSUwQSUwQWRlcHRoX2VzdGltYXRvciUyMCUzRCUyMHBpcGVsaW5lKCUyMmRlcHRoLWVzdGltYXRpb24lMjIpJTBBaGludCUyMCUzRCUyMG1ha2VfaGludChpbWclMkMlMjBkZXB0aF9lc3RpbWF0b3IpLnVuc3F1ZWV6ZSgwKS5oYWxmKCkudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image


<span class="hljs-keyword">def</span> <span class="hljs-title function_">make_hint</span>(<span class="hljs-params">image, depth_estimator</span>):
    image = depth_estimator(image)[<span class="hljs-string">&quot;depth&quot;</span>]
    image = np.array(image)
    image = image[:, :, <span class="hljs-literal">None</span>]
    image = np.concatenate([image, image, image], axis=<span class="hljs-number">2</span>)
    detected_map = torch.from_numpy(image).<span class="hljs-built_in">float</span>() / <span class="hljs-number">255.0</span>
    hint = detected_map.permute(<span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> hint


depth_estimator = pipeline(<span class="hljs-string">&quot;depth-estimation&quot;</span>)
hint = make_hint(img, depth_estimator).unsqueeze(<span class="hljs-number">0</span>).half().to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Ce=new _({props:{title:"Text-to-image",local:"controlnet-text-to-image",headingTag:"h3"}}),Qe=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0UGlwZWxpbmUlMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSl0byglMjJjdWRhJTIyKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIyQ29udHJvbG5ldFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1jb250cm9sbmV0LWRlcHRoJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSkudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22ControlnetPipeline

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
)to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline = KandinskyV22ControlnetPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-controlnet-depth&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Fe=new $({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQSUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEFpbWFnZV9lbWIlMkMlMjB6ZXJvX2ltYWdlX2VtYiUyMCUzRCUyMHBpcGVfcHJpb3IoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJpb3JfcHJvbXB0JTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTBBKS50b190dXBsZSgp",highlighted:`prompt = <span class="hljs-string">&quot;A robot, 4k photo&quot;</span>

negative_prior_prompt = <span class="hljs-string">&quot;lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">43</span>)
image_emb, zero_image_emb = pipe_prior(
    prompt=prompt, negative_prompt=negative_prior_prompt, generator=generator
).to_tuple()`,wrap:!1}}),Se=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWIlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0R6ZXJvX2ltYWdlX2VtYiUyQyUyMGhpbnQlM0RoaW50JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjgpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`image = pipeline(image_embeds=image_emb, negative_image_embeds=zero_image_emb, hint=hint, num_inference_steps=<span class="hljs-number">50</span>, generator=generator, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),ze=new _({props:{title:"Image-to-image",local:"controlnet-image-to-image",headingTag:"h3"}}),Ke=new $({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIyUHJpb3JFbWIyRW1iUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0SW1nMkltZ1BpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMjIlMjAlMjIlMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkpJTBBJTBBJTBBZGVmJTIwbWFrZV9oaW50KGltYWdlJTJDJTIwZGVwdGhfZXN0aW1hdG9yKSUzQSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwZGVwdGhfZXN0aW1hdG9yKGltYWdlKSU1QiUyMmRlcHRoJTIyJTVEJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBucC5hcnJheShpbWFnZSklMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMGltYWdlJTVCJTNBJTJDJTIwJTNBJTJDJTIwTm9uZSU1RCUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwbnAuY29uY2F0ZW5hdGUoJTVCaW1hZ2UlMkMlMjBpbWFnZSUyQyUyMGltYWdlJTVEJTJDJTIwYXhpcyUzRDIpJTBBJTIwJTIwJTIwJTIwZGV0ZWN0ZWRfbWFwJTIwJTNEJTIwdG9yY2guZnJvbV9udW1weShpbWFnZSkuZmxvYXQoKSUyMCUyRiUyMDI1NS4wJTBBJTIwJTIwJTIwJTIwaGludCUyMCUzRCUyMGRldGVjdGVkX21hcC5wZXJtdXRlKDIlMkMlMjAwJTJDJTIwMSklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBoaW50JTBBJTBBJTBBZGVwdGhfZXN0aW1hdG9yJTIwJTNEJTIwcGlwZWxpbmUoJTIyZGVwdGgtZXN0aW1hdGlvbiUyMiklMEFoaW50JTIwJTNEJTIwbWFrZV9oaW50KGltZyUyQyUyMGRlcHRoX2VzdGltYXRvcikudW5zcXVlZXplKDApLmhhbGYoKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorEmb2EmbPipeline, KandinskyV22ControlnetImg2ImgPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

img = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span> <span class="hljs-string">&quot;/kandinskyv22/cat.png&quot;</span>
).resize((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))


<span class="hljs-keyword">def</span> <span class="hljs-title function_">make_hint</span>(<span class="hljs-params">image, depth_estimator</span>):
    image = depth_estimator(image)[<span class="hljs-string">&quot;depth&quot;</span>]
    image = np.array(image)
    image = image[:, :, <span class="hljs-literal">None</span>]
    image = np.concatenate([image, image, image], axis=<span class="hljs-number">2</span>)
    detected_map = torch.from_numpy(image).<span class="hljs-built_in">float</span>() / <span class="hljs-number">255.0</span>
    hint = detected_map.permute(<span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> hint


depth_estimator = pipeline(<span class="hljs-string">&quot;depth-estimation&quot;</span>)
hint = make_hint(img, depth_estimator).unsqueeze(<span class="hljs-number">0</span>).half().to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Pe=new $({props:{code:"cHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvckVtYjJFbWJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIyQ29udHJvbG5ldEltZzJJbWdQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItY29udHJvbG5ldC1kZXB0aCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMik=",highlighted:`prior_pipeline = KandinskyV22PriorEmb2EmbPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline = KandinskyV22ControlnetImg2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-controlnet-depth&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Ae=new $({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEElMEFpbWdfZW1iJTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltZyUyQyUyMHN0cmVuZ3RoJTNEMC44NSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciklMEFuZWdhdGl2ZV9lbWIlMjAlM0QlMjBwaXBlX3ByaW9yKHByb21wdCUzRG5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyQyUyMGltYWdlJTNEaW1nJTJDJTIwc3RyZW5ndGglM0QxJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yKQ==",highlighted:`prompt = <span class="hljs-string">&quot;A robot, 4k photo&quot;</span>
negative_prior_prompt = <span class="hljs-string">&quot;lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">43</span>)

img_emb = pipe_prior(prompt=prompt, image=img, strength=<span class="hljs-number">0.85</span>, generator=generator)
negative_emb = pipe_prior(prompt=negative_prior_prompt, image=img, strength=<span class="hljs-number">1</span>, generator=generator)`,wrap:!1}}),et=new $({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZSUzRGltZyUyQyUyMHN0cmVuZ3RoJTNEMC41JTJDJTIwaW1hZ2VfZW1iZWRzJTNEaW1nX2VtYi5pbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9lbWIuaW1hZ2VfZW1iZWRzJTJDJTIwaGludCUzRGhpbnQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`image = pipeline(image=img, strength=<span class="hljs-number">0.5</span>, image_embeds=img_emb.image_embeds, negative_image_embeds=negative_emb.image_embeds, hint=hint, num_inference_steps=<span class="hljs-number">50</span>, generator=generator, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),tt=new _({props:{title:"Optimizations",local:"optimizations",headingTag:"h2"}}),nt=new $({props:{code:"JTIwJTIwZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTIwJTIwaW1wb3J0JTIwdG9yY2glMEElMEElMjAlMjBwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQSUyQiUyMHBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKCk=",highlighted:`  from diffusers import DiffusionPipeline
  import torch

  pipe = DiffusionPipeline.from_pretrained(&quot;kandinsky-community/kandinsky-2-1&quot;, torch_dtype=torch.float16)
<span class="hljs-addition">+ pipe.enable_xformers_memory_efficient_attention()</span>`,wrap:!1}}),at=new $({props:{code:"JTIwJTIwcGlwZS51bmV0LnRvKG1lbW9yeV9mb3JtYXQlM0R0b3JjaC5jaGFubmVsc19sYXN0KSUwQSUyQiUyMHBpcGUudW5ldCUyMCUzRCUyMHRvcmNoLmNvbXBpbGUocGlwZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZWQtb3ZlcmhlYWQlMjIlMkMlMjBmdWxsZ3JhcGglM0RUcnVlKSUwQSUwQSUyMCUyMHBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTJCJTIwcGlwZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKQ==",highlighted:`  pipe.unet.to(memory_format=torch.channels_last)
<span class="hljs-addition">+ pipe.unet = torch.compile(pipe.unet, mode=&quot;reduced-overhead&quot;, fullgraph=True)</span>

  pipe = DiffusionPipeline.from_pretrained(&quot;kandinsky-community/kandinsky-2-1&quot;, torch_dtype=torch.float16)
<span class="hljs-addition">+ pipe.enable_xformers_memory_efficient_attention()</span>`,wrap:!1}}),pt=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5tb2RlbHMuYXR0ZW50aW9uX3Byb2Nlc3NvciUyMGltcG9ydCUyMEF0dG5BZGRlZEtWUHJvY2Vzc29yMl8wJTBBJTBBcGlwZS51bmV0LnNldF9hdHRuX3Byb2Nlc3NvcihBdHRuQWRkZWRLVlByb2Nlc3NvcjJfMCgpKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.models.attention_processor <span class="hljs-keyword">import</span> AttnAddedKVProcessor2_0

pipe.unet.set_attn_processor(AttnAddedKVProcessor2_0())`,wrap:!1}}),rt=new $({props:{code:"JTIwJTIwZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTIwJTIwaW1wb3J0JTIwdG9yY2glMEElMEElMjAlMjBwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQSUyQiUyMHBpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCk=",highlighted:`  from diffusers import DiffusionPipeline
  import torch

  pipe = DiffusionPipeline.from_pretrained(&quot;kandinsky-community/kandinsky-2-1&quot;, torch_dtype=torch.float16)
<span class="hljs-addition">+ pipe.enable_model_cpu_offload()</span>`,wrap:!1}}),mt=new $({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEREUE1TQ2hlZHVsZXIlMEElMEFzY2hlZHVsZXIlMjAlM0QlMjBERFBNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMmRkcG1fc2NoZWR1bGVyJTIyKSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjBzY2hlZHVsZXIlM0RzY2hlZHVsZXIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDPMSCheduler

scheduler = DDPMScheduler.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, subfolder=<span class="hljs-string">&quot;ddpm_scheduler&quot;</span>)
pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, scheduler=scheduler, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){s=g("meta"),r=o(),t=g("p"),m=o(),d(l.$$.fragment),n=o(),d(J.$$.fragment),U=o(),I=g("p"),I.textContent=B,k=o(),T=g("p"),T.innerHTML=zs,ct=o(),te=g("p"),te.innerHTML=xs,dt=o(),se=g("p"),se.textContent=Es,yt=o(),le=g("p"),le.textContent=qs,ut=o(),d(ne.$$.fragment),ft=o(),d(R.$$.fragment),Mt=o(),d(ae.$$.fragment),ht=o(),ie=g("p"),ie.innerHTML=Ks,Jt=o(),d(v.$$.fragment),bt=o(),pe=g("p"),pe.innerHTML=Ls,gt=o(),re=g("p"),re.innerHTML=Ps,wt=o(),d(X.$$.fragment),Zt=o(),d(me.$$.fragment),kt=o(),oe=g("p"),oe.textContent=Ds,Ut=o(),d(C.$$.fragment),$t=o(),ce=g("p"),ce.textContent=As,Tt=o(),d(de.$$.fragment),Wt=o(),H=g("div"),H.innerHTML=Os,jt=o(),ye=g("p"),ye.innerHTML=el,Gt=o(),d(ue.$$.fragment),It=o(),fe=g("p"),fe.textContent=tl,Bt=o(),d(Q.$$.fragment),Vt=o(),Me=g("p"),Me.innerHTML=sl,_t=o(),he=g("p"),he.innerHTML=ll,Rt=o(),d(Y.$$.fragment),vt=o(),d(Je.$$.fragment),Xt=o(),d(F.$$.fragment),Ct=o(),be=g("p"),be.textContent=nl,Ht=o(),d(N.$$.fragment),Qt=o(),ge=g("p"),ge.textContent=al,Yt=o(),d(we.$$.fragment),Ft=o(),Ze=g("p"),Ze.textContent=il,Nt=o(),d(ke.$$.fragment),St=o(),Ue=g("p"),Ue.textContent=pl,zt=o(),d(S.$$.fragment),xt=o(),$e=g("p"),$e.innerHTML=rl,Et=o(),d(z.$$.fragment),qt=o(),d(Te.$$.fragment),Kt=o(),We=g("p"),We.textContent=ml,Lt=o(),d(x.$$.fragment),Pt=o(),E=g("div"),E.innerHTML=ol,Dt=o(),je=g("p"),je.textContent=cl,At=o(),d(Ge.$$.fragment),Ot=o(),Ie=g("p"),Ie.innerHTML=dl,es=o(),d(q.$$.fragment),ts=o(),d(Be.$$.fragment),ss=o(),d(K.$$.fragment),ls=o(),Ve=g("p"),Ve.textContent=yl,ns=o(),_e=g("p"),_e.textContent=ul,as=o(),d(Re.$$.fragment),is=o(),L=g("div"),L.innerHTML=fl,ps=o(),ve=g("p"),ve.innerHTML=Ml,rs=o(),d(Xe.$$.fragment),ms=o(),d(Ce.$$.fragment),os=o(),He=g("p"),He.innerHTML=hl,cs=o(),d(Qe.$$.fragment),ds=o(),Ye=g("p"),Ye.textContent=Jl,ys=o(),d(Fe.$$.fragment),us=o(),Ne=g("p"),Ne.innerHTML=bl,fs=o(),d(Se.$$.fragment),Ms=o(),P=g("div"),P.innerHTML=gl,hs=o(),d(ze.$$.fragment),Js=o(),xe=g("p"),xe.textContent=wl,bs=o(),Ee=g("ul"),Ee.innerHTML=Zl,gs=o(),qe=g("p"),qe.innerHTML=kl,ws=o(),d(Ke.$$.fragment),Zs=o(),Le=g("p"),Le.innerHTML=Ul,ks=o(),d(Pe.$$.fragment),Us=o(),De=g("p"),De.textContent=$l,$s=o(),d(Ae.$$.fragment),Ts=o(),Oe=g("p"),Oe.innerHTML=Tl,Ws=o(),d(et.$$.fragment),js=o(),D=g("div"),D.innerHTML=Wl,Gs=o(),d(tt.$$.fragment),Is=o(),st=g("p"),st.textContent=jl,Bs=o(),lt=g("ol"),lt.innerHTML=Gl,Vs=o(),d(nt.$$.fragment),_s=o(),A=g("ol"),A.innerHTML=Il,Rs=o(),d(at.$$.fragment),vs=o(),it=g("p"),it.innerHTML=Bl,Xs=o(),d(pt.$$.fragment),Cs=o(),O=g("ol"),O.innerHTML=Vl,Hs=o(),d(rt.$$.fragment),Qs=o(),ee=g("ol"),ee.innerHTML=_l,Ys=o(),d(mt.$$.fragment),Fs=o(),ot=g("p"),this.h()},l(e){const a=Al("svelte-u9bgzb",document.head);s=w(a,"META",{name:!0,content:!0}),a.forEach(i),r=c(e),t=w(e,"P",{}),ql(t).forEach(i),m=c(e),y(l.$$.fragment,e),n=c(e),y(J.$$.fragment,e),U=c(e),I=w(e,"P",{"data-svelte-h":!0}),Z(I)!=="svelte-nyn2ud"&&(I.textContent=B),k=c(e),T=w(e,"P",{"data-svelte-h":!0}),Z(T)!=="svelte-rc0qhg"&&(T.innerHTML=zs),ct=c(e),te=w(e,"P",{"data-svelte-h":!0}),Z(te)!=="svelte-1lazcye"&&(te.innerHTML=xs),dt=c(e),se=w(e,"P",{"data-svelte-h":!0}),Z(se)!=="svelte-1l6ivg9"&&(se.textContent=Es),yt=c(e),le=w(e,"P",{"data-svelte-h":!0}),Z(le)!=="svelte-cwruts"&&(le.textContent=qs),ut=c(e),y(ne.$$.fragment,e),ft=c(e),y(R.$$.fragment,e),Mt=c(e),y(ae.$$.fragment,e),ht=c(e),ie=w(e,"P",{"data-svelte-h":!0}),Z(ie)!=="svelte-kq2poq"&&(ie.innerHTML=Ks),Jt=c(e),y(v.$$.fragment,e),bt=c(e),pe=w(e,"P",{"data-svelte-h":!0}),Z(pe)!=="svelte-1ia5b2q"&&(pe.innerHTML=Ls),gt=c(e),re=w(e,"P",{"data-svelte-h":!0}),Z(re)!=="svelte-enihv1"&&(re.innerHTML=Ps),wt=c(e),y(X.$$.fragment,e),Zt=c(e),y(me.$$.fragment,e),kt=c(e),oe=w(e,"P",{"data-svelte-h":!0}),Z(oe)!=="svelte-1x1inrp"&&(oe.textContent=Ds),Ut=c(e),y(C.$$.fragment,e),$t=c(e),ce=w(e,"P",{"data-svelte-h":!0}),Z(ce)!=="svelte-1sl9181"&&(ce.textContent=As),Tt=c(e),y(de.$$.fragment,e),Wt=c(e),H=w(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(H)!=="svelte-1w2zk95"&&(H.innerHTML=Os),jt=c(e),ye=w(e,"P",{"data-svelte-h":!0}),Z(ye)!=="svelte-ctvdye"&&(ye.innerHTML=el),Gt=c(e),y(ue.$$.fragment,e),It=c(e),fe=w(e,"P",{"data-svelte-h":!0}),Z(fe)!=="svelte-zsncr3"&&(fe.textContent=tl),Bt=c(e),y(Q.$$.fragment,e),Vt=c(e),Me=w(e,"P",{"data-svelte-h":!0}),Z(Me)!=="svelte-1tkzfu"&&(Me.innerHTML=sl),_t=c(e),he=w(e,"P",{"data-svelte-h":!0}),Z(he)!=="svelte-1mrjxh5"&&(he.innerHTML=ll),Rt=c(e),y(Y.$$.fragment,e),vt=c(e),y(Je.$$.fragment,e),Xt=c(e),y(F.$$.fragment,e),Ct=c(e),be=w(e,"P",{"data-svelte-h":!0}),Z(be)!=="svelte-1h9m0px"&&(be.textContent=nl),Ht=c(e),y(N.$$.fragment,e),Qt=c(e),ge=w(e,"P",{"data-svelte-h":!0}),Z(ge)!=="svelte-1lisfug"&&(ge.textContent=al),Yt=c(e),y(we.$$.fragment,e),Ft=c(e),Ze=w(e,"P",{"data-svelte-h":!0}),Z(Ze)!=="svelte-1seehfb"&&(Ze.textContent=il),Nt=c(e),y(ke.$$.fragment,e),St=c(e),Ue=w(e,"P",{"data-svelte-h":!0}),Z(Ue)!=="svelte-1c90mh7"&&(Ue.textContent=pl),zt=c(e),y(S.$$.fragment,e),xt=c(e),$e=w(e,"P",{"data-svelte-h":!0}),Z($e)!=="svelte-19cbvto"&&($e.innerHTML=rl),Et=c(e),y(z.$$.fragment,e),qt=c(e),y(Te.$$.fragment,e),Kt=c(e),We=w(e,"P",{"data-svelte-h":!0}),Z(We)!=="svelte-iexz0f"&&(We.textContent=ml),Lt=c(e),y(x.$$.fragment,e),Pt=c(e),E=w(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(E)!=="svelte-1c7h32m"&&(E.innerHTML=ol),Dt=c(e),je=w(e,"P",{"data-svelte-h":!0}),Z(je)!=="svelte-1yz0908"&&(je.textContent=cl),At=c(e),y(Ge.$$.fragment,e),Ot=c(e),Ie=w(e,"P",{"data-svelte-h":!0}),Z(Ie)!=="svelte-lrlri1"&&(Ie.innerHTML=dl),es=c(e),y(q.$$.fragment,e),ts=c(e),y(Be.$$.fragment,e),ss=c(e),y(K.$$.fragment,e),ls=c(e),Ve=w(e,"P",{"data-svelte-h":!0}),Z(Ve)!=="svelte-1shkert"&&(Ve.textContent=yl),ns=c(e),_e=w(e,"P",{"data-svelte-h":!0}),Z(_e)!=="svelte-191d2jn"&&(_e.textContent=ul),as=c(e),y(Re.$$.fragment,e),is=c(e),L=w(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(L)!=="svelte-11gtyyz"&&(L.innerHTML=fl),ps=c(e),ve=w(e,"P",{"data-svelte-h":!0}),Z(ve)!=="svelte-cpjujb"&&(ve.innerHTML=Ml),rs=c(e),y(Xe.$$.fragment,e),ms=c(e),y(Ce.$$.fragment,e),os=c(e),He=w(e,"P",{"data-svelte-h":!0}),Z(He)!=="svelte-h6d89t"&&(He.innerHTML=hl),cs=c(e),y(Qe.$$.fragment,e),ds=c(e),Ye=w(e,"P",{"data-svelte-h":!0}),Z(Ye)!=="svelte-ncejue"&&(Ye.textContent=Jl),ys=c(e),y(Fe.$$.fragment,e),us=c(e),Ne=w(e,"P",{"data-svelte-h":!0}),Z(Ne)!=="svelte-1x84eg0"&&(Ne.innerHTML=bl),fs=c(e),y(Se.$$.fragment,e),Ms=c(e),P=w(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(P)!=="svelte-1oo0se1"&&(P.innerHTML=gl),hs=c(e),y(ze.$$.fragment,e),Js=c(e),xe=w(e,"P",{"data-svelte-h":!0}),Z(xe)!=="svelte-1hxrtxz"&&(xe.textContent=wl),bs=c(e),Ee=w(e,"UL",{"data-svelte-h":!0}),Z(Ee)!=="svelte-1wnirbi"&&(Ee.innerHTML=Zl),gs=c(e),qe=w(e,"P",{"data-svelte-h":!0}),Z(qe)!=="svelte-1eccwor"&&(qe.innerHTML=kl),ws=c(e),y(Ke.$$.fragment,e),Zs=c(e),Le=w(e,"P",{"data-svelte-h":!0}),Z(Le)!=="svelte-1bme2gp"&&(Le.innerHTML=Ul),ks=c(e),y(Pe.$$.fragment,e),Us=c(e),De=w(e,"P",{"data-svelte-h":!0}),Z(De)!=="svelte-1ltdt5k"&&(De.textContent=$l),$s=c(e),y(Ae.$$.fragment,e),Ts=c(e),Oe=w(e,"P",{"data-svelte-h":!0}),Z(Oe)!=="svelte-gs93x4"&&(Oe.innerHTML=Tl),Ws=c(e),y(et.$$.fragment,e),js=c(e),D=w(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(D)!=="svelte-eey5ka"&&(D.innerHTML=Wl),Gs=c(e),y(tt.$$.fragment,e),Is=c(e),st=w(e,"P",{"data-svelte-h":!0}),Z(st)!=="svelte-1x6zzpe"&&(st.textContent=jl),Bs=c(e),lt=w(e,"OL",{"data-svelte-h":!0}),Z(lt)!=="svelte-1q6w7fa"&&(lt.innerHTML=Gl),Vs=c(e),y(nt.$$.fragment,e),_s=c(e),A=w(e,"OL",{start:!0,"data-svelte-h":!0}),Z(A)!=="svelte-ksjijr"&&(A.innerHTML=Il),Rs=c(e),y(at.$$.fragment,e),vs=c(e),it=w(e,"P",{"data-svelte-h":!0}),Z(it)!=="svelte-1ruz9lc"&&(it.innerHTML=Bl),Xs=c(e),y(pt.$$.fragment,e),Cs=c(e),O=w(e,"OL",{start:!0,"data-svelte-h":!0}),Z(O)!=="svelte-1bcl59f"&&(O.innerHTML=Vl),Hs=c(e),y(rt.$$.fragment,e),Qs=c(e),ee=w(e,"OL",{start:!0,"data-svelte-h":!0}),Z(ee)!=="svelte-gz9ims"&&(ee.innerHTML=_l),Ys=c(e),y(mt.$$.fragment,e),Fs=c(e),ot=w(e,"P",{}),ql(ot).forEach(i),this.h()},h(){G(s,"name","hf:doc:metadata"),G(s,"content",Cn),G(H,"class","flex justify-center"),G(E,"class","flex gap-4"),G(L,"class","flex justify-center"),G(P,"class","flex justify-center"),G(D,"class","flex justify-center"),G(A,"start","2"),G(O,"start","3"),G(ee,"start","4")},m(e,a){Ol(document.head,s),p(e,r,a),p(e,t,a),p(e,m,a),u(l,e,a),p(e,n,a),u(J,e,a),p(e,U,a),p(e,I,a),p(e,k,a),p(e,T,a),p(e,ct,a),p(e,te,a),p(e,dt,a),p(e,se,a),p(e,yt,a),p(e,le,a),p(e,ut,a),u(ne,e,a),p(e,ft,a),u(R,e,a),p(e,Mt,a),u(ae,e,a),p(e,ht,a),p(e,ie,a),p(e,Jt,a),u(v,e,a),p(e,bt,a),p(e,pe,a),p(e,gt,a),p(e,re,a),p(e,wt,a),u(X,e,a),p(e,Zt,a),u(me,e,a),p(e,kt,a),p(e,oe,a),p(e,Ut,a),u(C,e,a),p(e,$t,a),p(e,ce,a),p(e,Tt,a),u(de,e,a),p(e,Wt,a),p(e,H,a),p(e,jt,a),p(e,ye,a),p(e,Gt,a),u(ue,e,a),p(e,It,a),p(e,fe,a),p(e,Bt,a),u(Q,e,a),p(e,Vt,a),p(e,Me,a),p(e,_t,a),p(e,he,a),p(e,Rt,a),u(Y,e,a),p(e,vt,a),u(Je,e,a),p(e,Xt,a),u(F,e,a),p(e,Ct,a),p(e,be,a),p(e,Ht,a),u(N,e,a),p(e,Qt,a),p(e,ge,a),p(e,Yt,a),u(we,e,a),p(e,Ft,a),p(e,Ze,a),p(e,Nt,a),u(ke,e,a),p(e,St,a),p(e,Ue,a),p(e,zt,a),u(S,e,a),p(e,xt,a),p(e,$e,a),p(e,Et,a),u(z,e,a),p(e,qt,a),u(Te,e,a),p(e,Kt,a),p(e,We,a),p(e,Lt,a),u(x,e,a),p(e,Pt,a),p(e,E,a),p(e,Dt,a),p(e,je,a),p(e,At,a),u(Ge,e,a),p(e,Ot,a),p(e,Ie,a),p(e,es,a),u(q,e,a),p(e,ts,a),u(Be,e,a),p(e,ss,a),u(K,e,a),p(e,ls,a),p(e,Ve,a),p(e,ns,a),p(e,_e,a),p(e,as,a),u(Re,e,a),p(e,is,a),p(e,L,a),p(e,ps,a),p(e,ve,a),p(e,rs,a),u(Xe,e,a),p(e,ms,a),u(Ce,e,a),p(e,os,a),p(e,He,a),p(e,cs,a),u(Qe,e,a),p(e,ds,a),p(e,Ye,a),p(e,ys,a),u(Fe,e,a),p(e,us,a),p(e,Ne,a),p(e,fs,a),u(Se,e,a),p(e,Ms,a),p(e,P,a),p(e,hs,a),u(ze,e,a),p(e,Js,a),p(e,xe,a),p(e,bs,a),p(e,Ee,a),p(e,gs,a),p(e,qe,a),p(e,ws,a),u(Ke,e,a),p(e,Zs,a),p(e,Le,a),p(e,ks,a),u(Pe,e,a),p(e,Us,a),p(e,De,a),p(e,$s,a),u(Ae,e,a),p(e,Ts,a),p(e,Oe,a),p(e,Ws,a),u(et,e,a),p(e,js,a),p(e,D,a),p(e,Gs,a),u(tt,e,a),p(e,Is,a),p(e,st,a),p(e,Bs,a),p(e,lt,a),p(e,Vs,a),u(nt,e,a),p(e,_s,a),p(e,A,a),p(e,Rs,a),u(at,e,a),p(e,vs,a),p(e,it,a),p(e,Xs,a),u(pt,e,a),p(e,Cs,a),p(e,O,a),p(e,Hs,a),u(rt,e,a),p(e,Qs,a),p(e,ee,a),p(e,Ys,a),u(mt,e,a),p(e,Fs,a),p(e,ot,a),Ns=!0},p(e,[a]){const Rl={};a&2&&(Rl.$$scope={dirty:a,ctx:e}),R.$set(Rl);const vl={};a&2&&(vl.$$scope={dirty:a,ctx:e}),v.$set(vl);const Xl={};a&2&&(Xl.$$scope={dirty:a,ctx:e}),X.$set(Xl);const Cl={};a&2&&(Cl.$$scope={dirty:a,ctx:e}),C.$set(Cl);const Hl={};a&2&&(Hl.$$scope={dirty:a,ctx:e}),Q.$set(Hl);const Ql={};a&2&&(Ql.$$scope={dirty:a,ctx:e}),Y.$set(Ql);const Yl={};a&2&&(Yl.$$scope={dirty:a,ctx:e}),F.$set(Yl);const Fl={};a&2&&(Fl.$$scope={dirty:a,ctx:e}),N.$set(Fl);const Nl={};a&2&&(Nl.$$scope={dirty:a,ctx:e}),S.$set(Nl);const Sl={};a&2&&(Sl.$$scope={dirty:a,ctx:e}),z.$set(Sl);const zl={};a&2&&(zl.$$scope={dirty:a,ctx:e}),x.$set(zl);const xl={};a&2&&(xl.$$scope={dirty:a,ctx:e}),q.$set(xl);const El={};a&2&&(El.$$scope={dirty:a,ctx:e}),K.$set(El)},i(e){Ns||(f(l.$$.fragment,e),f(J.$$.fragment,e),f(ne.$$.fragment,e),f(R.$$.fragment,e),f(ae.$$.fragment,e),f(v.$$.fragment,e),f(X.$$.fragment,e),f(me.$$.fragment,e),f(C.$$.fragment,e),f(de.$$.fragment,e),f(ue.$$.fragment,e),f(Q.$$.fragment,e),f(Y.$$.fragment,e),f(Je.$$.fragment,e),f(F.$$.fragment,e),f(N.$$.fragment,e),f(we.$$.fragment,e),f(ke.$$.fragment,e),f(S.$$.fragment,e),f(z.$$.fragment,e),f(Te.$$.fragment,e),f(x.$$.fragment,e),f(Ge.$$.fragment,e),f(q.$$.fragment,e),f(Be.$$.fragment,e),f(K.$$.fragment,e),f(Re.$$.fragment,e),f(Xe.$$.fragment,e),f(Ce.$$.fragment,e),f(Qe.$$.fragment,e),f(Fe.$$.fragment,e),f(Se.$$.fragment,e),f(ze.$$.fragment,e),f(Ke.$$.fragment,e),f(Pe.$$.fragment,e),f(Ae.$$.fragment,e),f(et.$$.fragment,e),f(tt.$$.fragment,e),f(nt.$$.fragment,e),f(at.$$.fragment,e),f(pt.$$.fragment,e),f(rt.$$.fragment,e),f(mt.$$.fragment,e),Ns=!0)},o(e){M(l.$$.fragment,e),M(J.$$.fragment,e),M(ne.$$.fragment,e),M(R.$$.fragment,e),M(ae.$$.fragment,e),M(v.$$.fragment,e),M(X.$$.fragment,e),M(me.$$.fragment,e),M(C.$$.fragment,e),M(de.$$.fragment,e),M(ue.$$.fragment,e),M(Q.$$.fragment,e),M(Y.$$.fragment,e),M(Je.$$.fragment,e),M(F.$$.fragment,e),M(N.$$.fragment,e),M(we.$$.fragment,e),M(ke.$$.fragment,e),M(S.$$.fragment,e),M(z.$$.fragment,e),M(Te.$$.fragment,e),M(x.$$.fragment,e),M(Ge.$$.fragment,e),M(q.$$.fragment,e),M(Be.$$.fragment,e),M(K.$$.fragment,e),M(Re.$$.fragment,e),M(Xe.$$.fragment,e),M(Ce.$$.fragment,e),M(Qe.$$.fragment,e),M(Fe.$$.fragment,e),M(Se.$$.fragment,e),M(ze.$$.fragment,e),M(Ke.$$.fragment,e),M(Pe.$$.fragment,e),M(Ae.$$.fragment,e),M(et.$$.fragment,e),M(tt.$$.fragment,e),M(nt.$$.fragment,e),M(at.$$.fragment,e),M(pt.$$.fragment,e),M(rt.$$.fragment,e),M(mt.$$.fragment,e),Ns=!1},d(e){e&&(i(r),i(t),i(m),i(n),i(U),i(I),i(k),i(T),i(ct),i(te),i(dt),i(se),i(yt),i(le),i(ut),i(ft),i(Mt),i(ht),i(ie),i(Jt),i(bt),i(pe),i(gt),i(re),i(wt),i(Zt),i(kt),i(oe),i(Ut),i($t),i(ce),i(Tt),i(Wt),i(H),i(jt),i(ye),i(Gt),i(It),i(fe),i(Bt),i(Vt),i(Me),i(_t),i(he),i(Rt),i(vt),i(Xt),i(Ct),i(be),i(Ht),i(Qt),i(ge),i(Yt),i(Ft),i(Ze),i(Nt),i(St),i(Ue),i(zt),i(xt),i($e),i(Et),i(qt),i(Kt),i(We),i(Lt),i(Pt),i(E),i(Dt),i(je),i(At),i(Ot),i(Ie),i(es),i(ts),i(ss),i(ls),i(Ve),i(ns),i(_e),i(as),i(is),i(L),i(ps),i(ve),i(rs),i(ms),i(os),i(He),i(cs),i(ds),i(Ye),i(ys),i(us),i(Ne),i(fs),i(Ms),i(P),i(hs),i(Js),i(xe),i(bs),i(Ee),i(gs),i(qe),i(ws),i(Zs),i(Le),i(ks),i(Us),i(De),i($s),i(Ts),i(Oe),i(Ws),i(js),i(D),i(Gs),i(Is),i(st),i(Bs),i(lt),i(Vs),i(_s),i(A),i(Rs),i(vs),i(it),i(Xs),i(Cs),i(O),i(Hs),i(Qs),i(ee),i(Ys),i(Fs),i(ot)),i(s),h(l,e),h(J,e),h(ne,e),h(R,e),h(ae,e),h(v,e),h(X,e),h(me,e),h(C,e),h(de,e),h(ue,e),h(Q,e),h(Y,e),h(Je,e),h(F,e),h(N,e),h(we,e),h(ke,e),h(S,e),h(z,e),h(Te,e),h(x,e),h(Ge,e),h(q,e),h(Be,e),h(K,e),h(Re,e),h(Xe,e),h(Ce,e),h(Qe,e),h(Fe,e),h(Se,e),h(ze,e),h(Ke,e),h(Pe,e),h(Ae,e),h(et,e),h(tt,e),h(nt,e),h(at,e),h(pt,e),h(rt,e),h(mt,e)}}}const Cn='{"title":"Kandinsky","local":"kandinsky","sections":[{"title":"Text-to-image","local":"text-to-image","sections":[],"depth":2},{"title":"Image-to-image","local":"image-to-image","sections":[],"depth":2},{"title":"Inpainting","local":"inpainting","sections":[],"depth":2},{"title":"Interpolation","local":"interpolation","sections":[],"depth":2},{"title":"ControlNet","local":"controlnet","sections":[{"title":"Text-to-image","local":"controlnet-text-to-image","sections":[],"depth":3},{"title":"Image-to-image","local":"controlnet-image-to-image","sections":[],"depth":3}],"depth":2},{"title":"Optimizations","local":"optimizations","sections":[],"depth":2}],"depth":1}';function Hn(b){return Ll(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=en}),[]}class En extends Pl{constructor(s){super(),Dl(this,s,Hn,Xn,Kl,{})}}export{En as component};
