import{s as Ot,o as en,n as j}from"../chunks/scheduler.94020406.js";import{S as ln,i as sn,g,s as c,r as d,E as tn,h as T,f as p,c as y,j as At,u as J,x as Z,k as B,y as nn,a as i,v as u,d as f,t as b,w as U}from"../chunks/index.a08c8d92.js";import{T as Ks}from"../chunks/Tip.3b0aeee8.js";import{C as w}from"../chunks/CodeBlock.b23cf525.js";import{D as an}from"../chunks/DocNotebookDropdown.d8a25975.js";import{H as R,E as pn}from"../chunks/EditOnGithub.b1bceb47.js";import{H as I,a as V}from"../chunks/HfOption.df48b824.js";function mn(h){let s,m="Kandinsky 2.1과 2.2의 사용법은 매우 유사합니다! 유일한 차이점은 Kandinsky 2.2는 latents를 디코딩할 때 <code>프롬프트</code>를 입력으로 받지 않는다는 것입니다. 대신, Kandinsky 2.2는 디코딩 중에는 <code>image_embeds</code>만 받아들입니다.",l,o,t,n,r='Kandinsky 3는 더 간결한 아키텍처를 가지고 있으며 prior 모델이 필요하지 않습니다. 즉, <a href="sdxl">Stable Diffusion XL</a>과 같은 다른 diffusion 모델과 사용법이 동일합니다.';return{c(){s=g("p"),s.innerHTML=m,l=c(),o=g("br"),t=c(),n=g("p"),n.innerHTML=r},l(M){s=T(M,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-b9k2c4"&&(s.innerHTML=m),l=y(M),o=T(M,"BR",{}),t=y(M),n=T(M,"P",{"data-svelte-h":!0}),Z(n)!=="svelte-dmj9qa"&&(n.innerHTML=r)},m(M,W){i(M,s,W),i(M,l,W),i(M,o,W),i(M,t,W),i(M,n,W)},p:j,d(M){M&&(p(s),p(l),p(o),p(t),p(n))}}}function rn(h){let s,m,l,o="이제 모든 프롬프트와 임베딩을 <code>KandinskyPipeline</code>에 전달하여 이미지를 생성합니다:",t,n,r,M,W='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/cheeseburger.png"/>',G;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwYWxpZW4lMjBjaGVlc2VidXJnZXIlMjBjcmVhdHVyZSUyMGVhdGluZyUyMGl0c2VsZiUyQyUyMGNsYXltYXRpb24lMkMlMjBjaW5lbWF0aWMlMkMlMjBtb29keSUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMjAlMjMlMjBuZWdhdGl2ZSUyMCVFRCU5NCU4NCVFQiVBMSVBQyVFRCU5NCU4NCVFRCU4QSVCOCUyMCVFRCU4RiVBQyVFRCU5NSVBOCVFQyU5RCU4MCUyMCVFQyU4NCVBMCVFRCU4MyU5RCVFQyVBMCU4MSVFQyU5RCVCNCVFQyVBNyU4MCVFQiVBNyU4QyUyQyUyMCVFQiVCMyVCNCVFRCU4NiVCNSUyMCVFQSVCMiVCMCVFQSVCMyVCQyVFQiU4QSU5NCUyMCVFQiU4RCU5NCUyMCVFQyVBMiU4QiVFQyU4QSVCNSVFQiU4QiU4OCVFQiU4QiVBNCUwQWltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyMCUzRCUyMHByaW9yX3BpcGVsaW5lKHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEMS4wKS50b190dXBsZSgp",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"># negative 프롬프트 포함은 선택적이지만, 보통 결과는 더 좋습니다</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 w({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",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>]
image`,wrap:!1}}),{c(){d(s.$$.fragment),m=c(),l=g("p"),l.innerHTML=o,t=c(),d(n.$$.fragment),r=c(),M=g("div"),M.innerHTML=W,this.h()},l(k){J(s.$$.fragment,k),m=y(k),l=T(k,"P",{"data-svelte-h":!0}),Z(l)!=="svelte-1t17459"&&(l.innerHTML=o),t=y(k),J(n.$$.fragment,k),r=y(k),M=T(k,"DIV",{class:!0,"data-svelte-h":!0}),Z(M)!=="svelte-i75i2v"&&(M.innerHTML=W),this.h()},h(){B(M,"class","flex justify-center")},m(k,$){u(s,k,$),i(k,m,$),i(k,l,$),i(k,t,$),u(n,k,$),i(k,r,$),i(k,M,$),G=!0},p:j,i(k){G||(f(s.$$.fragment,k),f(n.$$.fragment,k),G=!0)},o(k){b(s.$$.fragment,k),b(n.$$.fragment,k),G=!1},d(k){k&&(p(m),p(l),p(t),p(r),p(M)),U(s,k),U(n,k)}}}function on(h){let s,m,l,o="이미지 생성을 위해 <code>image_embeds</code>와 <code>negative_image_embeds</code>를 <code>KandinskyV22Pipeline</code>에 전달합니다:",t,n,r,M,W='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-text-to-image.png"/>',G;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBhbGllbiUyMGNoZWVzZWJ1cmdlciUyMGNyZWF0dXJlJTIwZWF0aW5nJTIwaXRzZWxmJTJDJTIwY2xheW1hdGlvbiUyQyUyMGNpbmVtYXRpYyUyQyUyMG1vb2R5JTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUyMCUyMyUyMG5lZ2F0aXZlJTIwJUVEJTk0JTg0JUVCJUExJUFDJUVEJTk0JTg0JUVEJThBJUI4JTIwJUVEJThGJUFDJUVEJTk1JUE4JUVDJTlEJTgwJTIwJUVDJTg0JUEwJUVEJTgzJTlEJUVDJUEwJTgxJUVDJTlEJUI0JUVDJUE3JTgwJUVCJUE3JThDJTJDJTIwJUVCJUIzJUI0JUVEJTg2JUI1JTIwJUVBJUIyJUIwJUVBJUIzJUJDJUVCJThBJTk0JTIwJUVCJThEJTk0JTIwJUVDJUEyJThCJUVDJThBJUI1JUVCJThCJTg4JUVCJThCJUE0JTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxLjApLnRvX3R1cGxlKCk=",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"># negative 프롬프트 포함은 선택적이지만, 보통 결과는 더 좋습니다</span>
image_embeds, negative_image_embeds = prior_pipeline(prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`,wrap:!1}}),n=new w({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",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>]
image`,wrap:!1}}),{c(){d(s.$$.fragment),m=c(),l=g("p"),l.innerHTML=o,t=c(),d(n.$$.fragment),r=c(),M=g("div"),M.innerHTML=W,this.h()},l(k){J(s.$$.fragment,k),m=y(k),l=T(k,"P",{"data-svelte-h":!0}),Z(l)!=="svelte-sgv3t4"&&(l.innerHTML=o),t=y(k),J(n.$$.fragment,k),r=y(k),M=T(k,"DIV",{class:!0,"data-svelte-h":!0}),Z(M)!=="svelte-kkab9k"&&(M.innerHTML=W),this.h()},h(){B(M,"class","flex justify-center")},m(k,$){u(s,k,$),i(k,m,$),i(k,l,$),i(k,t,$),u(n,k,$),i(k,r,$),i(k,M,$),G=!0},p:j,i(k){G||(f(s.$$.fragment,k),f(n.$$.fragment,k),G=!0)},o(k){b(s.$$.fragment,k),b(n.$$.fragment,k),G=!1},d(k){k&&(p(m),p(l),p(t),p(r),p(M)),U(s,k),U(n,k)}}}function cn(h){let s,m="Kandinsky 3는 prior 모델이 필요하지 않으므로 <code>Kandinsky3Pipeline</code>을 직접 불러오고 이미지 생성 프롬프트를 전달할 수 있습니다:",l,o,t;return o=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreTNQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3kzUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMyUyMiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGVsaW5lLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGFsaWVuJTIwY2hlZXNlYnVyZ2VyJTIwY3JlYXR1cmUlMjBlYXRpbmclMjBpdHNlbGYlMkMlMjBjbGF5bWF0aW9uJTJDJTIwY2luZW1hdGljJTJDJTIwbW9vZHklMjBsaWdodGluZyUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky3Pipeline
<span class="hljs-keyword">import</span> torch

pipeline = Kandinsky3Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-3&quot;</span>, variant=<span class="hljs-string">&quot;fp16&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>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){s=g("p"),s.innerHTML=m,l=c(),d(o.$$.fragment)},l(n){s=T(n,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-8t9irm"&&(s.innerHTML=m),l=y(n),J(o.$$.fragment,n)},m(n,r){i(n,s,r),i(n,l,r),u(o,n,r),t=!0},p:j,i(n){t||(f(o.$$.fragment,n),t=!0)},o(n){b(o.$$.fragment,n),t=!1},d(n){n&&(p(s),p(l)),U(o,n)}}}function yn(h){let s,m,l,o,t,n;return s=new V({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[rn]},$$scope:{ctx:h}}}),l=new V({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[on]},$$scope:{ctx:h}}}),t=new V({props:{id:"text-to-image",option:"Kandinsky 3",$$slots:{default:[cn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment),o=c(),d(t.$$.fragment)},l(r){J(s.$$.fragment,r),m=y(r),J(l.$$.fragment,r),o=y(r),J(t.$$.fragment,r)},m(r,M){u(s,r,M),i(r,m,M),u(l,r,M),i(r,o,M),u(t,r,M),n=!0},p(r,M){const W={};M&2&&(W.$$scope={dirty:M,ctx:r}),s.$set(W);const G={};M&2&&(G.$$scope={dirty:M,ctx:r}),l.$set(G);const k={};M&2&&(k.$$scope={dirty:M,ctx:r}),t.$set(k)},i(r){n||(f(s.$$.fragment,r),f(l.$$.fragment,r),f(t.$$.fragment,r),n=!0)},o(r){b(s.$$.fragment,r),b(l.$$.fragment,r),b(t.$$.fragment,r),n=!1},d(r){r&&(p(m),p(o)),U(s,r),U(l,r),U(t,r)}}}function Mn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwYWxpZW4lMjBjaGVlc2VidXJnZXIlMjBjcmVhdHVyZSUyMGVhdGluZyUyMGl0c2VsZiUyQyUyMGNsYXltYXRpb24lMkMlMjBjaW5lbWF0aWMlMkMlMjBtb29keSUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUyMHByaW9yX2d1aWRhbmNlX3NjYWxlJTNEMS4wJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q0LjAlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",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>]
image`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function dn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItZGVjb2RlciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBhbGllbiUyMGNoZWVzZWJ1cmdlciUyMGNyZWF0dXJlJTIwZWF0aW5nJTIwaXRzZWxmJTJDJTIwY2xheW1hdGlvbiUyQyUyMGNpbmVtYXRpYyUyQyUyMG1vb2R5JTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwcHJpb3JfZ3VpZGFuY2Vfc2NhbGUlM0QxLjAlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDQuMCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",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>]
image`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Jn(h){let s,m,l,o;return s=new V({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[Mn]},$$scope:{ctx:h}}}),l=new V({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[dn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function un(h){let s,m;return s=new w({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(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function fn(h){let s,m;return s=new w({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(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function bn(h){let s,m="Kandinsky 3는 prior 모델이 필요하지 않으므로 image-to-image 파이프라인을 직접 불러올 수 있습니다:",l,o,t;return o=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreTNJbWcySW1nUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3kzSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTMlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky3Img2ImgPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

pipeline = Kandinsky3Img2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-3&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()`,wrap:!1}}),{c(){s=g("p"),s.textContent=m,l=c(),d(o.$$.fragment)},l(n){s=T(n,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-1ojs3r5"&&(s.textContent=m),l=y(n),J(o.$$.fragment,n)},m(n,r){i(n,s,r),i(n,l,r),u(o,n,r),t=!0},p:j,i(n){t||(f(o.$$.fragment,n),t=!0)},o(n){b(o.$$.fragment,n),t=!1},d(n){n&&(p(s),p(l)),U(o,n)}}}function Un(h){let s,m,l,o,t,n;return s=new V({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[un]},$$scope:{ctx:h}}}),l=new V({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[fn]},$$scope:{ctx:h}}}),t=new V({props:{id:"image-to-image",option:"Kandinsky 3",$$slots:{default:[bn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment),o=c(),d(t.$$.fragment)},l(r){J(s.$$.fragment,r),m=y(r),J(l.$$.fragment,r),o=y(r),J(t.$$.fragment,r)},m(r,M){u(s,r,M),i(r,m,M),u(l,r,M),i(r,o,M),u(t,r,M),n=!0},p(r,M){const W={};M&2&&(W.$$scope={dirty:M,ctx:r}),s.$set(W);const G={};M&2&&(G.$$scope={dirty:M,ctx:r}),l.$set(G);const k={};M&2&&(k.$$scope={dirty:M,ctx:r}),t.$set(k)},i(r){n||(f(s.$$.fragment,r),f(l.$$.fragment,r),f(t.$$.fragment,r),n=!0)},o(r){b(s.$$.fragment,r),b(l.$$.fragment,r),b(t.$$.fragment,r),n=!1},d(r){r&&(p(m),p(o)),U(s,r),U(l,r),U(t,r)}}}function hn(h){let s,m,l,o='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/img2img_fantasyland.png"/>',t;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMGltYWdlX2VtYmVkcyUzRGltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQlMEFtYWtlX2ltYWdlX2dyaWQoJTVCb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid

image = pipeline(prompt, negative_prompt=negative_prompt, image=original_image, image_embeds=image_embeds, 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>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){d(s.$$.fragment),m=c(),l=g("div"),l.innerHTML=o,this.h()},l(n){J(s.$$.fragment,n),m=y(n),l=T(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(l)!=="svelte-1vh4dwd"&&(l.innerHTML=o),this.h()},h(){B(l,"class","flex justify-center")},m(n,r){u(s,n,r),i(n,m,r),i(n,l,r),t=!0},p:j,i(n){t||(f(s.$$.fragment,n),t=!0)},o(n){b(s.$$.fragment,n),t=!1},d(n){n&&(p(m),p(l)),U(s,n)}}}function gn(h){let s,m,l,o='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-image-to-image.png"/>',t;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUoaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMGltYWdlX2VtYmVkcyUzRGltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQlMEFtYWtlX2ltYWdlX2dyaWQoJTVCb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid

image = pipeline(image=original_image, image_embeds=image_embeds, 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>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){d(s.$$.fragment),m=c(),l=g("div"),l.innerHTML=o,this.h()},l(n){J(s.$$.fragment,n),m=y(n),l=T(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(l)!=="svelte-1vux4a0"&&(l.innerHTML=o),this.h()},h(){B(l,"class","flex justify-center")},m(n,r){u(s,n,r),i(n,m,r),i(n,l,r),t=!0},p:j,i(n){t||(f(s.$$.fragment,n),t=!0)},o(n){b(s.$$.fragment,n),t=!1},d(n){n&&(p(m),p(l)),U(s,n)}}}function Tn(h){let s,m;return s=new w({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTJDJTIwc3RyZW5ndGglM0QwLjc1JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI1KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`image = pipeline(prompt, negative_prompt=negative_prompt, image=image, strength=<span class="hljs-number">0.75</span>, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function kn(h){let s,m,l,o,t,n;return s=new V({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[hn]},$$scope:{ctx:h}}}),l=new V({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[gn]},$$scope:{ctx:h}}}),t=new V({props:{id:"image-to-image",option:"Kandinsky 3",$$slots:{default:[Tn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment),o=c(),d(t.$$.fragment)},l(r){J(s.$$.fragment,r),m=y(r),J(l.$$.fragment,r),o=y(r),J(t.$$.fragment,r)},m(r,M){u(s,r,M),i(r,m,M),u(l,r,M),i(r,o,M),u(t,r,M),n=!0},p(r,M){const W={};M&2&&(W.$$scope={dirty:M,ctx:r}),s.$set(W);const G={};M&2&&(G.$$scope={dirty:M,ctx:r}),l.$set(G);const k={};M&2&&(k.$$scope={dirty:M,ctx:r}),t.$set(k)},i(r){n||(f(s.$$.fragment,r),f(l.$$.fragment,r),f(t.$$.fragment,r),n=!0)},o(r){b(s.$$.fragment,r),b(l.$$.fragment,r),b(t.$$.fragment,r),n=!1},d(r){r&&(p(m),p(o)),U(s,r),U(l,r),U(t,r)}}}function Zn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUyQyUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBmYW50YXN5JTIwbGFuZHNjYXBlJTJDJTIwQ2luZW1hdGljJTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKHVybCklMEElMEFvcmlnaW5hbF9pbWFnZS50aHVtYm5haWwoKDc2OCUyQyUyMDc2OCkpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQlMEFtYWtlX2ltYWdlX2dyaWQoJTVCb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid, load_image
<span class="hljs-keyword">import</span> torch

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>
original_image = load_image(url)

original_image.thumbnail((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

image = pipeline(prompt=prompt, negative_prompt=negative_prompt, image=original_image, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function wn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUyQyUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwZmFudGFzeSUyMGxhbmRzY2FwZSUyQyUyMENpbmVtYXRpYyUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbiUyRm1haW4lMkZhc3NldHMlMkZzdGFibGUtc2FtcGxlcyUyRmltZzJpbWclMkZza2V0Y2gtbW91bnRhaW5zLWlucHV0LmpwZyUyMiUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSh1cmwpJTBBJTBBb3JpZ2luYWxfaW1hZ2UudGh1bWJuYWlsKCg3NjglMkMlMjA3NjgpKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMHN0cmVuZ3RoJTNEMC4zKS5pbWFnZXMlNUIwJTVEJTBBbWFrZV9pbWFnZV9ncmlkKCU1Qm9yaWdpbmFsX2ltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklMkMlMjBpbWFnZS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid, load_image
<span class="hljs-keyword">import</span> torch

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>
original_image = load_image(url)

original_image.thumbnail((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

image = pipeline(prompt=prompt, negative_prompt=negative_prompt, image=original_image, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Wn(h){let s,m,l,o;return s=new V({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[Zn]},$$scope:{ctx:h}}}),l=new V({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[wn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function jn(h){let s,m="⚠️ Kandinsky 모델은 이제 검은색 픽셀 대신 ⬜️ <strong>흰색 픽셀</strong>을 사용하여 마스크 영역을 표현합니다. 프로덕션에서 <code>KandinskyInpaintPipeline</code>을 사용하는 경우 흰색 픽셀을 사용하도록 마스크를 변경해야 합니다:",l,o,t;return o=new w({props:{code:"JTIzJTIwUElMJTIwJUVDJTlFJTg1JUVCJUEwJUE1JUVDJTk3JTkwJTIwJUVCJThDJTgwJUVEJTk1JUI0JTBBaW1wb3J0JTIwUElMLkltYWdlT3BzJTBBbWFzayUyMCUzRCUyMFBJTC5JbWFnZU9wcy5pbnZlcnQobWFzayklMEElMEElMjMlMjBQeVRvcmNoJUVDJTk5JTgwJTIwTnVtUHklMjAlRUMlOUUlODUlRUIlQTAlQTUlRUMlOTclOTAlMjAlRUIlOEMlODAlRUQlOTUlQjQlMEFtYXNrJTIwJTNEJTIwMSUyMC0lMjBtYXNr",highlighted:`<span class="hljs-comment"># PIL 입력에 대해</span>
<span class="hljs-keyword">import</span> PIL.ImageOps
mask = PIL.ImageOps.invert(mask)

<span class="hljs-comment"># PyTorch와 NumPy 입력에 대해</span>
mask = <span class="hljs-number">1</span> - mask`,wrap:!1}}),{c(){s=g("p"),s.innerHTML=m,l=c(),d(o.$$.fragment)},l(n){s=T(n,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-19cj2ra"&&(s.innerHTML=m),l=y(n),J(o.$$.fragment,n)},m(n,r){i(n,s,r),i(n,l,r),u(o,n,r),t=!0},p:j,i(n){t||(f(o.$$.fragment,n),t=!0)},o(n){b(o.$$.fragment,n),t=!1},d(n){n&&(p(s),p(l)),U(o,n)}}}function $n(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUyQyUyMG1ha2VfaW1hZ2VfZ3JpZCUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLWlucGFpbnQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKQ==",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, make_image_grid
<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> PIL <span class="hljs-keyword">import</span> Image

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(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Vn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMklucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUyQyUyMG1ha2VfaW1hZ2VfZ3JpZCUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXItaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIp",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, make_image_grid
<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> PIL <span class="hljs-keyword">import</span> Image

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(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Gn(h){let s,m,l,o;return s=new V({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[$n]},$$scope:{ctx:h}}}),l=new V({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Vn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function Bn(h){let s,m,l,o='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/inpaint_cat_hat.png"/>',t;return s=new w({props:{code:"b3V0cHV0X2ltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2slMkMlMjAqKnByaW9yX291dHB1dCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDE1MCkuaW1hZ2VzJTVCMCU1RCUwQW1hc2slMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkoKG1hc2sqMjU1KS5hc3R5cGUoJ3VpbnQ4JyklMkMlMjAnTCcpJTBBbWFrZV9pbWFnZV9ncmlkKCU1QmluaXRfaW1hZ2UlMkMlMjBtYXNrJTJDJTIwb3V0cHV0X2ltYWdlJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMyk=",highlighted:`output_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>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){d(s.$$.fragment),m=c(),l=g("div"),l.innerHTML=o,this.h()},l(n){J(s.$$.fragment,n),m=y(n),l=T(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(l)!=="svelte-1d04i1f"&&(l.innerHTML=o),this.h()},h(){B(l,"class","flex justify-center")},m(n,r){u(s,n,r),i(n,m,r),i(n,l,r),t=!0},p:j,i(n){t||(f(s.$$.fragment,n),t=!0)},o(n){b(s.$$.fragment,n),t=!1},d(n){n&&(p(m),p(l)),U(s,n)}}}function In(h){let s,m,l,o='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinskyv22-inpaint.png"/>',t;return s=new w({props:{code:"b3V0cHV0X2ltYWdlJTIwJTNEJTIwcGlwZWxpbmUoaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2slMkMlMjAqKnByaW9yX291dHB1dCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDE1MCkuaW1hZ2VzJTVCMCU1RCUwQW1hc2slMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkoKG1hc2sqMjU1KS5hc3R5cGUoJ3VpbnQ4JyklMkMlMjAnTCcpJTBBbWFrZV9pbWFnZV9ncmlkKCU1QmluaXRfaW1hZ2UlMkMlMjBtYXNrJTJDJTIwb3V0cHV0X2ltYWdlJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMyk=",highlighted:`output_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>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){d(s.$$.fragment),m=c(),l=g("div"),l.innerHTML=o,this.h()},l(n){J(s.$$.fragment,n),m=y(n),l=T(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(l)!=="svelte-1ajezuw"&&(l.innerHTML=o),this.h()},h(){B(l,"class","flex justify-center")},m(n,r){u(s,n,r),i(n,m,r),i(n,l,r),t=!0},p:j,i(n){t||(f(s.$$.fragment,n),t=!0)},o(n){b(s.$$.fragment,n),t=!1},d(n){n&&(p(m),p(l)),U(s,n)}}}function Rn(h){let s,m,l,o;return s=new V({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[Bn]},$$scope:{ctx:h}}}),l=new V({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[In]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function _n(h){let s,m;return s=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBJTBBcGlwZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLWlucGFpbnQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZjYXQucG5nJTIyKSUwQW1hc2slMjAlM0QlMjBucC56ZXJvcygoNzY4JTJDJTIwNzY4KSUyQyUyMGR0eXBlJTNEbnAuZmxvYXQzMiklMEElMjMlMjAlRUElQjMlQTAlRUMlOTYlOTElRUMlOUQlQjQlMjAlRUIlQTglQjglRUIlQTYlQUMlMjAlRUMlOUMlODQlMjAlRUIlQTclODglRUMlOEElQTQlRUQlODElQUMlMjAlRUMlQTclODAlRUMlOTclQUQlMEFtYXNrJTVCJTNBMjUwJTJDJTIwMjUwJTNBLTI1MCU1RCUyMCUzRCUyMDElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwaGF0JTIyJTBBJTBBb3V0cHV0X2ltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGluaXRfaW1hZ2UlMkMlMjBtYXNrX2ltYWdlJTNEbWFzaykuaW1hZ2VzJTVCMCU1RCUwQW1hc2slMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkoKG1hc2sqMjU1KS5hc3R5cGUoJ3VpbnQ4JyklMkMlMjAnTCcpJTBBbWFrZV9pbWFnZV9ncmlkKCU1QmluaXRfaW1hZ2UlMkMlMjBtYXNrJTJDJTIwb3V0cHV0X2ltYWdlJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMyk=",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> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid

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()

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"># 고양이 머리 위 마스크 지역</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>
prompt = <span class="hljs-string">&quot;a hat&quot;</span>

output_image = pipe(prompt=prompt, image=init_image, mask_image=mask).images[<span class="hljs-number">0</span>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Cn(h){let s,m;return s=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBJTBBcGlwZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXItaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBbWFzayUyMCUzRCUyMG5wLnplcm9zKCg3NjglMkMlMjA3NjgpJTJDJTIwZHR5cGUlM0RucC5mbG9hdDMyKSUwQSUyMyUyMCVFQSVCMyVBMCVFQyU5NiU5MSVFQyU5RCVCNCUyMCVFQiVBOCVCOCVFQiVBNiVBQyUyMCVFQyU5QyU4NCUyMCVFQiVBNyU4OCVFQyU4QSVBNCVFRCU4MSVBQyUyMCVFQyU5OCU4MSVFQyU5NyVBRCUwQW1hc2slNUIlM0EyNTAlMkMlMjAyNTAlM0EtMjUwJTVEJTIwJTNEJTIwMSUwQXByb21wdCUyMCUzRCUyMCUyMmElMjBoYXQlMjIlMEElMEFvdXRwdXRfaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEb3JpZ2luYWxfaW1hZ2UlMkMlMjBtYXNrX2ltYWdlJTNEbWFzaykuaW1hZ2VzJTVCMCU1RCUwQW1hc2slMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkoKG1hc2sqMjU1KS5hc3R5cGUoJ3VpbnQ4JyklMkMlMjAnTCcpJTBBbWFrZV9pbWFnZV9ncmlkKCU1QmluaXRfaW1hZ2UlMkMlMjBtYXNrJTJDJTIwb3V0cHV0X2ltYWdlJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMyk=",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> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid

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()

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"># 고양이 머리 위 마스크 영역</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>
prompt = <span class="hljs-string">&quot;a hat&quot;</span>

output_image = pipe(prompt=prompt, image=original_image, mask_image=mask).images[<span class="hljs-number">0</span>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Qn(h){let s,m,l,o;return s=new V({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[_n]},$$scope:{ctx:h}}}),l=new V({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Cn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function Xn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWdfMSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBaW1nXzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZzdGFycnlfbmlnaHQuanBlZyUyMiklMEFtYWtlX2ltYWdlX2dyaWQoJTVCaW1nXzEucmVzaXplKCg1MTIlMkM1MTIpKSUyQyUyMGltZ18yLnJlc2l6ZSgoNTEyJTJDNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",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, make_image_grid
<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>)
make_image_grid([img_1.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>)), img_2.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function vn(h){let s,m;return s=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWdfMSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBaW1nXzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZzdGFycnlfbmlnaHQuanBlZyUyMiklMEFtYWtlX2ltYWdlX2dyaWQoJTVCaW1nXzEucmVzaXplKCg1MTIlMkM1MTIpKSUyQyUyMGltZ18yLnJlc2l6ZSgoNTEyJTJDNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",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, make_image_grid
<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>)
make_image_grid([img_1.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>)), img_2.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){d(s.$$.fragment)},l(l){J(s.$$.fragment,l)},m(l,o){u(s,l,o),m=!0},p:j,i(l){m||(f(s.$$.fragment,l),m=!0)},o(l){b(s.$$.fragment,l),m=!1},d(l){U(s,l)}}}function Yn(h){let s,m,l,o;return s=new V({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Xn]},$$scope:{ctx:h}}}),l=new V({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[vn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function Nn(h){let s,m,l,o='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/starry_cat.png"/>',t;return s=new w({props:{code:"JTIzJTIwJUVEJTk0JTg0JUVCJUExJUFDJUVEJTk0JTg0JUVEJThBJUI4JUVCJThBJTk0JTIwJUVCJUI5JTg4JUVDJUI5JUI4JUVDJTlDJUJDJUVCJUExJTlDJTIwJUVCJTgyJUE4JUVBJUIyJUE4JUVCJThGJTg0JTIwJUVCJTkwJUE5JUVCJThCJTg4JUVCJThCJUE0JTBBcHJvbXB0JTIwJTNEJTIwJTIyJTIyJTBBcHJpb3Jfb3V0JTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUuaW50ZXJwb2xhdGUoaW1hZ2VzX3RleHRzJTJDJTIwd2VpZ2h0cyklMEElMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjAqKnByaW9yX291dCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`<span class="hljs-comment"># 프롬프트는 빈칸으로 남겨도 됩니다</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),m=c(),l=g("div"),l.innerHTML=o,this.h()},l(n){J(s.$$.fragment,n),m=y(n),l=T(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(l)!=="svelte-twgci5"&&(l.innerHTML=o),this.h()},h(){B(l,"class","flex justify-center")},m(n,r){u(s,n,r),i(n,m,r),i(n,l,r),t=!0},p:j,i(n){t||(f(s.$$.fragment,n),t=!0)},o(n){b(s.$$.fragment,n),t=!1},d(n){n&&(p(m),p(l)),U(s,n)}}}function Fn(h){let s,m,l,o='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinskyv22-interpolate.png"/>',t;return s=new w({props:{code:"JTIzJTIwJUVEJTk0JTg0JUVCJUExJUFDJUVEJTk0JTg0JUVEJThBJUI4JUVCJThBJTk0JTIwJUVCJUI5JTg4JUVDJUI5JUI4JUVDJTlDJUJDJUVCJUExJTlDJTIwJUVCJTgyJUE4JUVBJUIyJUE4JUVCJThGJTg0JTIwJUVCJTkwJUE5JUVCJThCJTg4JUVCJThCJUE0JTBBcHJvbXB0JTIwJTNEJTIwJTIyJTIyJTBBcHJpb3Jfb3V0JTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUuaW50ZXJwb2xhdGUoaW1hZ2VzX3RleHRzJTJDJTIwd2VpZ2h0cyklMEElMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMCoqcHJpb3Jfb3V0JTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjgpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-comment"># 프롬프트는 빈칸으로 남겨도 됩니다</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),m=c(),l=g("div"),l.innerHTML=o,this.h()},l(n){J(s.$$.fragment,n),m=y(n),l=T(n,"DIV",{class:!0,"data-svelte-h":!0}),Z(l)!=="svelte-2ur4ou"&&(l.innerHTML=o),this.h()},h(){B(l,"class","flex justify-center")},m(n,r){u(s,n,r),i(n,m,r),i(n,l,r),t=!0},p:j,i(n){t||(f(s.$$.fragment,n),t=!0)},o(n){b(s.$$.fragment,n),t=!1},d(n){n&&(p(m),p(l)),U(s,n)}}}function Hn(h){let s,m,l,o;return s=new V({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Nn]},$$scope:{ctx:h}}}),l=new V({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[Fn]},$$scope:{ctx:h}}}),{c(){d(s.$$.fragment),m=c(),d(l.$$.fragment)},l(t){J(s.$$.fragment,t),m=y(t),J(l.$$.fragment,t)},m(t,n){u(s,t,n),i(t,m,n),u(l,t,n),o=!0},p(t,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:t}),s.$set(r);const M={};n&2&&(M.$$scope={dirty:n,ctx:t}),l.$set(M)},i(t){o||(f(s.$$.fragment,t),f(l.$$.fragment,t),o=!0)},o(t){b(s.$$.fragment,t),b(l.$$.fragment,t),o=!1},d(t){t&&p(m),U(s,t),U(l,t)}}}function En(h){let s,m="⚠️ ControlNet은 Kandinsky 2.2에서만 지원됩니다!";return{c(){s=g("p"),s.textContent=m},l(l){s=T(l,"P",{"data-svelte-h":!0}),Z(s)!=="svelte-zcr86x"&&(s.textContent=m)},m(l,o){i(l,s,o)},p:j,d(l){l&&p(s)}}}function zn(h){let s,m,l,o,t,n,r,M,W,G="Kandinsky 모델은 일련의 다국어 text-to-image 생성 모델입니다. Kandinsky 2.0 모델은 두 개의 다국어 텍스트 인코더를 사용하고 그 결과를 연결해 UNet에 사용됩니다.",k,$,Ds='<a href="../api/pipelines/kandinsky">Kandinsky 2.1</a>은 텍스트와 이미지 임베딩 간의 매핑을 생성하는 image prior 모델(<a href="https://huggingface.co/docs/transformers/model_doc/clip" rel="nofollow"><code>CLIP</code></a>)을 포함하도록 아키텍처를 변경했습니다. 이 매핑은 더 나은 text-image alignment를 제공하며, 학습 중에 텍스트 임베딩과 함께 사용되어 더 높은 품질의 결과를 가져옵니다. 마지막으로, Kandinsky 2.1은 spatial conditional 정규화 레이어를 추가하여 사실감을 높여주는 <a href="https://huggingface.co/papers/2209.09002" rel="nofollow">Modulating Quantized Vectors (MoVQ)</a> 디코더를 사용하여 latents를 이미지로 디코딩합니다.',Ml,le,qs='<a href="../api/pipelines/kandinsky_v22">Kandinsky 2.2</a>는 image prior 모델의 이미지 인코더를 더 큰 CLIP-ViT-G 모델로 교체하여 품질을 개선함으로써 이전 모델을 개선했습니다. 또한 image prior 모델은 해상도와 종횡비가 다른 이미지로 재훈련되어 더 높은 해상도의 이미지와 다양한 이미지 크기를 생성합니다.',dl,se,Ls='<a href="../api/pipelines/kandinsky3">Kandinsky 3</a>는 아키텍처를 단순화하고 prior 모델과 diffusion 모델을 포함하는 2단계 생성 프로세스에서 벗어나고 있습니다. 대신, Kandinsky 3는 <a href="https://huggingface.co/google/flan-ul2" rel="nofollow">Flan-UL2</a>를 사용하여 텍스트를 인코딩하고, <a href="https://hf.co/papers/1809.11096" rel="nofollow">BigGan-deep</a> 블록이 포함된 UNet을 사용하며, <a href="https://github.com/ai-forever/MoVQGAN" rel="nofollow">Sber-MoVQGAN</a>을 사용하여 latents를 이미지로 디코딩합니다. 텍스트 이해와 생성된 이미지 품질은 주로 더 큰 텍스트 인코더와 UNet을 사용함으로써 달성됩니다.',Jl,te,Ps="이 가이드에서는 text-to-image, image-to-image, 인페인팅, 보간 등을 위해 Kandinsky 모델을 사용하는 방법을 설명합니다.",ul,ne,As="시작하기 전에 다음 라이브러리가 설치되어 있는지 확인하세요:",fl,ae,bl,_,Ul,pe,hl,ie,Os="모든 작업에 Kandinsky 모델을 사용하려면 항상 프롬프트를 인코딩하고 이미지 임베딩을 생성하는 prior 파이프라인을 설정하는 것부터 시작해야 합니다. 이전 파이프라인은 negative 프롬프트 <code>&quot;&quot;</code>에 해당하는 <code>negative_image_embeds</code>도 생성합니다. 더 나은 결과를 얻으려면 이전 파이프라인에 실제 <code>negative_prompt</code>를 전달할 수 있지만, 이렇게 하면 prior 파이프라인의 유효 배치 크기가 2배로 증가합니다.",gl,C,Tl,me,et="🤗 Diffusers는 또한 <code>KandinskyCombinedPipeline</code> 및 <code>KandinskyV22CombinedPipeline</code>이 포함된 end-to-end API를 제공하므로 prior 파이프라인과 text-to-image 변환 파이프라인을 별도로 불러올 필요가 없습니다. 결합된 파이프라인은 prior 모델과 디코더를 모두 자동으로 불러옵니다. 원하는 경우 <code>prior_guidance_scale</code> 및 <code>prior_num_inference_steps</code> 매개 변수를 사용하여 prior 파이프라인에 대해 다른 값을 설정할 수 있습니다.",kl,re,lt="내부에서 결합된 파이프라인을 자동으로 호출하려면 <code>AutoPipelineForText2Image</code>를 사용합니다:",Zl,Q,wl,oe,Wl,ce,st="Image-to-image 경우, 초기 이미지와 텍스트 프롬프트를 전달하여 파이프라인에 이미지를 conditioning합니다. Prior 파이프라인을 불러오는 것으로 시작합니다:",jl,X,$l,ye,tt="Conditioning할 이미지를 다운로드합니다:",Vl,Me,Gl,v,nt='<img class="rounded-xl" src="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"/>',Bl,de,at="Prior 파이프라인으로 <code>image_embeds</code>와 <code>negative_image_embeds</code>를 생성합니다:",Il,Je,Rl,ue,pt="이제 원본 이미지와 모든 프롬프트 및 임베딩을 파이프라인으로 전달하여 이미지를 생성합니다:",_l,Y,Cl,fe,it="또한 🤗 Diffusers에서는 <code>KandinskyImg2ImgCombinedPipeline</code> 및 <code>KandinskyV22Img2ImgCombinedPipeline</code>이 포함된 end-to-end API를 제공하므로 prior 파이프라인과 image-to-image 파이프라인을 별도로 불러올 필요가 없습니다. 결합된 파이프라인은 prior 모델과 디코더를 모두 자동으로 불러옵니다. 원하는 경우 <code>prior_guidance_scale</code> 및 <code>prior_num_inference_steps</code> 매개 변수를 사용하여 이전 파이프라인에 대해 다른 값을 설정할 수 있습니다.",Ql,be,mt="내부에서 결합된 파이프라인을 자동으로 호출하려면 <code>AutoPipelineForImage2Image</code>를 사용합니다:",Xl,N,vl,Ue,Yl,F,Nl,he,rt="인페인팅에서는 원본 이미지, 원본 이미지에서 대체할 영역의 마스크, 인페인팅할 내용에 대한 텍스트 프롬프트가 필요합니다. Prior 파이프라인을 불러옵니다:",Fl,H,Hl,ge,ot="초기 이미지를 불러오고 마스크를 생성합니다:",El,Te,zl,ke,ct="Prior 파이프라인으로 임베딩을 생성합니다:",Sl,Ze,xl,we,yt="이제 이미지 생성을 위해 초기 이미지, 마스크, 프롬프트와 임베딩을 파이프라인에 전달합니다:",Kl,E,Dl,We,Mt="<code>KandinskyInpaintCombinedPipeline</code> 및 <code>KandinskyV22InpaintCombinedPipeline</code>을 사용하여 내부에서 prior 및 디코더 파이프라인을 함께 호출할 수 있습니다. 이를 위해 <code>AutoPipelineForInpainting</code>을 사용합니다:",ql,z,Ll,je,Pl,$e,dt="Interpolation(보간)을 사용하면 이미지와 텍스트 임베딩 사이의 latent space를 탐색할 수 있어 prior 모델의 중간 결과물을 볼 수 있는 멋진 방법입니다. Prior 파이프라인과 보간하려는 두 개의 이미지를 불러옵니다:",Al,S,Ol,x,Jt='<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>',es,Ve,ut="보간할 텍스트 또는 이미지를 지정하고 각 텍스트 또는 이미지에 대한 가중치를 설정합니다. 가중치를 실험하여 보간에 어떤 영향을 미치는지 확인하세요!",ls,Ge,ss,Be,ft="<code>interpolate</code> 함수를 호출하여 임베딩을 생성한 다음, 파이프라인으로 전달하여 이미지를 생성합니다:",ts,K,ns,Ie,as,D,ps,Re,bt="ControlNet을 사용하면 depth map이나 edge detection와 같은 추가 입력을 통해 사전학습된 large diffusion 모델을 conditioning할 수 있습니다. 예를 들어, 모델이 depth map의 구조를 이해하고 보존할 수 있도록 깊이 맵으로 Kandinsky 2.2를 conditioning할 수 있습니다.",is,_e,Ut="이미지를 불러오고 depth map을 추출해 보겠습니다:",ms,Ce,rs,q,ht='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png"/>',os,Qe,gt="그런 다음 🤗 Transformers의 <code>depth-estimation</code> <code>Pipeline</code>을 사용하여 이미지를 처리해 depth map을 구할 수 있습니다:",cs,Xe,ys,ve,Ms,Ye,Tt="Prior 파이프라인과 <code>KandinskyV22ControlnetPipeline</code>를 불러옵니다:",ds,Ne,Js,Fe,kt="프롬프트와 negative 프롬프트로 이미지 임베딩을 생성합니다:",us,He,fs,Ee,Zt="마지막으로 이미지 임베딩과 depth 이미지를 <code>KandinskyV22ControlnetPipeline</code>에 전달하여 이미지를 생성합니다:",bs,ze,Us,L,wt='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat_text2img.png"/>',hs,Se,gs,xe,Wt="ControlNet을 사용한 image-to-image의 경우, 다음을 사용할 필요가 있습니다:",Ts,Ke,jt="<li><code>KandinskyV22PriorEmb2EmbPipeline</code>로 텍스트 프롬프트와 이미지에서 이미지 임베딩을 생성합니다.</li> <li><code>KandinskyV22ControlnetImg2ImgPipeline</code>로 초기 이미지와 이미지 임베딩에서 이미지를 생성합니다.</li>",ks,De,$t="🤗 Transformers에서 <code>depth-estimation</code> <code>Pipeline</code>을 사용하여 고양이의 초기 이미지의 depth map을 처리해 추출합니다:",Zs,qe,ws,Le,Vt="Prior 파이프라인과 <code>KandinskyV22ControlnetImg2ImgPipeline</code>을 불러옵니다:",Ws,Pe,js,Ae,Gt="텍스트 프롬프트와 초기 이미지를 이전 파이프라인에 전달하여 이미지 임베딩을 생성합니다:",$s,Oe,Vs,el,Bt="이제 <code>KandinskyV22ControlnetImg2ImgPipeline</code>을 실행하여 초기 이미지와 이미지 임베딩으로부터 이미지를 생성할 수 있습니다:",Gs,ll,Bs,P,It='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat.png"/>',Is,sl,Rs,tl,Rt="Kandinsky는 mapping을 생성하기 위한 prior 파이프라인과 latents를 이미지로 디코딩하기 위한 두 번째 파이프라인이 필요하다는 점에서 독특합니다. 대부분의 계산이 두 번째 파이프라인에서 이루어지므로 최적화의 노력은 두 번째 파이프라인에 집중되어야 합니다. 다음은 추론 중 Kandinsky키를 개선하기 위한 몇 가지 팁입니다.",_s,nl,_t='<li>PyTorch &lt; 2.0을 사용할 경우 <a href="../optimization/xformers">xFormers</a>을 활성화합니다.</li>',Cs,al,Qs,A,Ct="<li>PyTorch &gt;= 2.0을 사용할 경우 <code>torch.compile</code>을 활성화하여 scaled dot-product attention (SDPA)를 자동으로 사용하도록 합니다:</li>",Xs,pl,vs,il,Qt="이는 attention processor를 명시적으로 <code>AttnAddedKVProcessor2_0</code>을 사용하도록 설정하는 것과 동일합니다:",Ys,ml,Ns,O,Xt="<li>메모리 부족 오류를 방지하기 위해 <code>enable_model_cpu_offload()</code>를 사용하여 모델을 CPU로 오프로드합니다:</li>",Fs,rl,Hs,ee,vt="<li>기본적으로 text-to-image 파이프라인은 <code>DDIMScheduler</code>를 사용하지만, <code>DDPMScheduler</code>와 같은 다른 스케줄러로 대체하여 추론 속도와 이미지 품질 간의 균형에 어떤 영향을 미치는지 확인할 수 있습니다:</li>",Es,ol,zs,cl,Ss,yl,xs;return t=new R({props:{title:"Kandinsky",local:"kandinsky",headingTag:"h1"}}),r=new an({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/ko/kandinsky.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/kandinsky.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/kandinsky.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/kandinsky.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/kandinsky.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/kandinsky.ipynb"}]}}),ae=new w({props:{code:"JTIzJTIwQ29sYWIlRUMlOTclOTAlRUMlODQlOUMlMjAlRUQlOTUlODQlRUMlOUElOTQlRUQlOTUlOUMlMjAlRUIlOUQlQkMlRUMlOUQlQjQlRUIlQjglOEMlRUIlOUYlQUMlRUIlQTYlQUMlRUIlQTUlQkMlMjAlRUMlODQlQTQlRUMlQjklOTglRUQlOTUlOTglRUElQjglQjAlMjAlRUMlOUMlODQlRUQlOTUlQjQlMjAlRUMlQTMlQkMlRUMlODQlOUQlRUMlOUQlODQlMjAlRUMlQTAlOUMlRUMlOTklQjglRUQlOTUlOTglRUMlODQlQjglRUMlOUElOTQlMEElMjMhcGlwJTIwaW5zdGFsbCUyMC1xJTIwZGlmZnVzZXJzJTIwdHJhbnNmb3JtZXJzJTIwYWNjZWxlcmF0ZQ==",highlighted:`<span class="hljs-comment"># Colab에서 필요한 라이브러리를 설치하기 위해 주석을 제외하세요</span>
<span class="hljs-comment">#!pip install -q diffusers transformers accelerate</span>`,wrap:!1}}),_=new Ks({props:{warning:!0,$$slots:{default:[mn]},$$scope:{ctx:h}}}),pe=new R({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h2"}}),C=new I({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[yn]},$$scope:{ctx:h}}}),Q=new I({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Jn]},$$scope:{ctx:h}}}),oe=new R({props:{title:"Image-to-image",local:"image-to-image",headingTag:"h2"}}),X=new I({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[Un]},$$scope:{ctx:h}}}),Me=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEElMjMlMjAlRUMlOUQlQjQlRUIlQUYlQjglRUMlQTclODAlMjAlRUIlOEIlQTQlRUMlOUElQjQlRUIlQTElOUMlRUIlOTMlOUMlMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbiUyRm1haW4lMkZhc3NldHMlMkZzdGFibGUtc2FtcGxlcyUyRmltZzJpbWclMkZza2V0Y2gtbW91bnRhaW5zLWlucHV0LmpwZyUyMiUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSh1cmwpJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0QlMjBvcmlnaW5hbF9pbWFnZS5yZXNpemUoKDc2OCUyQyUyMDUxMikp",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

<span class="hljs-comment"># 이미지 다운로드</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>
original_image = load_image(url)
original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))`,wrap:!1}}),Je=new w({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}}),Y=new I({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[kn]},$$scope:{ctx:h}}}),N=new I({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Wn]},$$scope:{ctx:h}}}),Ue=new R({props:{title:"Inpainting",local:"inpainting",headingTag:"h2"}}),F=new Ks({props:{warning:!0,$$slots:{default:[jn]},$$scope:{ctx:h}}}),H=new I({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Gn]},$$scope:{ctx:h}}}),Te=new w({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}}),Ze=new w({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYSUyMGhhdCUyMiUwQXByaW9yX291dHB1dCUyMCUzRCUyMHByaW9yX3BpcGVsaW5lKHByb21wdCk=",highlighted:`prompt = <span class="hljs-string">&quot;a hat&quot;</span>
prior_output = prior_pipeline(prompt)`,wrap:!1}}),E=new I({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Rn]},$$scope:{ctx:h}}}),z=new I({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Qn]},$$scope:{ctx:h}}}),je=new R({props:{title:"Interpolation (보간)",local:"interpolation-보간",headingTag:"h2"}}),S=new I({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Yn]},$$scope:{ctx:h}}}),Ge=new w({props:{code:"aW1hZ2VzX3RleHRzJTIwJTNEJTIwJTVCJTIyYSUyMGNhdCUyMiUyQyUyMGltZ18xJTJDJTIwaW1nXzIlNUQlMEF3ZWlnaHRzJTIwJTNEJTIwJTVCMC4zJTJDJTIwMC4zJTJDJTIwMC40JTVE",highlighted:`images_texts = [<span class="hljs-string">&quot;a cat&quot;</span>, img_1, img_2]
weights = [<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.4</span>]`,wrap:!1}}),K=new I({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Hn]},$$scope:{ctx:h}}}),Ie=new R({props:{title:"ControlNet",local:"controlnet",headingTag:"h2"}}),D=new Ks({props:{warning:!0,$$slots:{default:[En]},$$scope:{ctx:h}}}),Ce=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkpJTBBaW1n",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>))
img`,wrap:!1}}),Xe=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFkZWYlMjBtYWtlX2hpbnQoaW1hZ2UlMkMlMjBkZXB0aF9lc3RpbWF0b3IpJTNBJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBkZXB0aF9lc3RpbWF0b3IoaW1hZ2UpJTVCJTIyZGVwdGglMjIlNUQlMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMG5wLmFycmF5KGltYWdlKSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwaW1hZ2UlNUIlM0ElMkMlMjAlM0ElMkMlMjBOb25lJTVEJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBucC5jb25jYXRlbmF0ZSglNUJpbWFnZSUyQyUyMGltYWdlJTJDJTIwaW1hZ2UlNUQlMkMlMjBheGlzJTNEMiklMEElMjAlMjAlMjAlMjBkZXRlY3RlZF9tYXAlMjAlM0QlMjB0b3JjaC5mcm9tX251bXB5KGltYWdlKS5mbG9hdCgpJTIwJTJGJTIwMjU1LjAlMEElMjAlMjAlMjAlMjBoaW50JTIwJTNEJTIwZGV0ZWN0ZWRfbWFwLnBlcm11dGUoMiUyQyUyMDAlMkMlMjAxKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGhpbnQlMEElMEFkZXB0aF9lc3RpbWF0b3IlMjAlM0QlMjBwaXBlbGluZSglMjJkZXB0aC1lc3RpbWF0aW9uJTIyKSUwQWhpbnQlMjAlM0QlMjBtYWtlX2hpbnQoaW1nJTJDJTIwZGVwdGhfZXN0aW1hdG9yKS51bnNxdWVlemUoMCkuaGFsZigpLnRvKCUyMmN1ZGElMjIp",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">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}}),ve=new R({props:{title:"Text-to-image",local:"controlnet-text-to-image",headingTag:"h3"}}),Ne=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0UGlwZWxpbmUlMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMkNvbnRyb2xuZXRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItY29udHJvbG5ldC1kZXB0aCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMik=",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
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),He=new w({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEElMEFpbWFnZV9lbWIlMkMlMjB6ZXJvX2ltYWdlX2VtYiUyMCUzRCUyMHByaW9yX3BpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUwQSkudG9fdHVwbGUoKQ==",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 = prior_pipeline(
    prompt=prompt, negative_prompt=negative_prior_prompt, generator=generator
).to_tuple()`,wrap:!1}}),ze=new w({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}}),Se=new R({props:{title:"Image-to-image",local:"controlnet-image-to-image",headingTag:"h3"}}),qe=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIyUHJpb3JFbWIyRW1iUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0SW1nMkltZ1BpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkpJTBBJTBBZGVmJTIwbWFrZV9oaW50KGltYWdlJTJDJTIwZGVwdGhfZXN0aW1hdG9yKSUzQSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwZGVwdGhfZXN0aW1hdG9yKGltYWdlKSU1QiUyMmRlcHRoJTIyJTVEJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBucC5hcnJheShpbWFnZSklMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMGltYWdlJTVCJTNBJTJDJTIwJTNBJTJDJTIwTm9uZSU1RCUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwbnAuY29uY2F0ZW5hdGUoJTVCaW1hZ2UlMkMlMjBpbWFnZSUyQyUyMGltYWdlJTVEJTJDJTIwYXhpcyUzRDIpJTBBJTIwJTIwJTIwJTIwZGV0ZWN0ZWRfbWFwJTIwJTNEJTIwdG9yY2guZnJvbV9udW1weShpbWFnZSkuZmxvYXQoKSUyMCUyRiUyMDI1NS4wJTBBJTIwJTIwJTIwJTIwaGludCUyMCUzRCUyMGRldGVjdGVkX21hcC5wZXJtdXRlKDIlMkMlMjAwJTJDJTIwMSklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBoaW50JTBBJTBBZGVwdGhfZXN0aW1hdG9yJTIwJTNEJTIwcGlwZWxpbmUoJTIyZGVwdGgtZXN0aW1hdGlvbiUyMiklMEFoaW50JTIwJTNEJTIwbWFrZV9oaW50KGltZyUyQyUyMGRlcHRoX2VzdGltYXRvcikudW5zcXVlZXplKDApLmhhbGYoKS50byglMjJjdWRhJTIyKQ==",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/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 w({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}}),Oe=new w({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEElMEFpbWdfZW1iJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWclMkMlMjBzdHJlbmd0aCUzRDAuODUlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpJTBBbmVnYXRpdmVfZW1iJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTNEbmVnYXRpdmVfcHJpb3JfcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWclMkMlMjBzdHJlbmd0aCUzRDElMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3Ip",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 = prior_pipeline(prompt=prompt, image=img, strength=<span class="hljs-number">0.85</span>, generator=generator)
negative_emb = prior_pipeline(prompt=negative_prior_prompt, image=img, strength=<span class="hljs-number">1</span>, generator=generator)`,wrap:!1}}),ll=new w({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZSUzRGltZyUyQyUyMHN0cmVuZ3RoJTNEMC41JTJDJTIwaW1hZ2VfZW1iZWRzJTNEaW1nX2VtYi5pbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9lbWIuaW1hZ2VfZW1iZWRzJTJDJTIwaGludCUzRGhpbnQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQW1ha2VfaW1hZ2VfZ3JpZCglNUJpbWcucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",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>]
make_image_grid([img.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),sl=new R({props:{title:"최적화",local:"최적화",headingTag:"h2"}}),al=new w({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}}),pl=new w({props:{code:"JTIwJTIwcGlwZS51bmV0LnRvKG1lbW9yeV9mb3JtYXQlM0R0b3JjaC5jaGFubmVsc19sYXN0KSUwQSUyQiUyMHBpcGUudW5ldCUyMCUzRCUyMHRvcmNoLmNvbXBpbGUocGlwZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZS1vdmVyaGVhZCUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUp",highlighted:`  pipe.unet.to(memory_format=torch.channels_last)
<span class="hljs-addition">+ pipe.unet = torch.compile(pipe.unet, mode=&quot;reduce-overhead&quot;, fullgraph=True)</span>`,wrap:!1}}),ml=new w({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}}),rl=new w({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}}),ol=new w({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEREUE1TY2hlZHVsZXIlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFzY2hlZHVsZXIlMjAlM0QlMjBERFBNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMmRkcG1fc2NoZWR1bGVyJTIyKSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjBzY2hlZHVsZXIlM0RzY2hlZHVsZXIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDPMScheduler
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

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}}),cl=new pn({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/using-diffusers/kandinsky.md"}}),{c(){s=g("meta"),m=c(),l=g("p"),o=c(),d(t.$$.fragment),n=c(),d(r.$$.fragment),M=c(),W=g("p"),W.textContent=G,k=c(),$=g("p"),$.innerHTML=Ds,Ml=c(),le=g("p"),le.innerHTML=qs,dl=c(),se=g("p"),se.innerHTML=Ls,Jl=c(),te=g("p"),te.textContent=Ps,ul=c(),ne=g("p"),ne.textContent=As,fl=c(),d(ae.$$.fragment),bl=c(),d(_.$$.fragment),Ul=c(),d(pe.$$.fragment),hl=c(),ie=g("p"),ie.innerHTML=Os,gl=c(),d(C.$$.fragment),Tl=c(),me=g("p"),me.innerHTML=et,kl=c(),re=g("p"),re.innerHTML=lt,Zl=c(),d(Q.$$.fragment),wl=c(),d(oe.$$.fragment),Wl=c(),ce=g("p"),ce.textContent=st,jl=c(),d(X.$$.fragment),$l=c(),ye=g("p"),ye.textContent=tt,Vl=c(),d(Me.$$.fragment),Gl=c(),v=g("div"),v.innerHTML=nt,Bl=c(),de=g("p"),de.innerHTML=at,Il=c(),d(Je.$$.fragment),Rl=c(),ue=g("p"),ue.textContent=pt,_l=c(),d(Y.$$.fragment),Cl=c(),fe=g("p"),fe.innerHTML=it,Ql=c(),be=g("p"),be.innerHTML=mt,Xl=c(),d(N.$$.fragment),vl=c(),d(Ue.$$.fragment),Yl=c(),d(F.$$.fragment),Nl=c(),he=g("p"),he.textContent=rt,Fl=c(),d(H.$$.fragment),Hl=c(),ge=g("p"),ge.textContent=ot,El=c(),d(Te.$$.fragment),zl=c(),ke=g("p"),ke.textContent=ct,Sl=c(),d(Ze.$$.fragment),xl=c(),we=g("p"),we.textContent=yt,Kl=c(),d(E.$$.fragment),Dl=c(),We=g("p"),We.innerHTML=Mt,ql=c(),d(z.$$.fragment),Ll=c(),d(je.$$.fragment),Pl=c(),$e=g("p"),$e.textContent=dt,Al=c(),d(S.$$.fragment),Ol=c(),x=g("div"),x.innerHTML=Jt,es=c(),Ve=g("p"),Ve.textContent=ut,ls=c(),d(Ge.$$.fragment),ss=c(),Be=g("p"),Be.innerHTML=ft,ts=c(),d(K.$$.fragment),ns=c(),d(Ie.$$.fragment),as=c(),d(D.$$.fragment),ps=c(),Re=g("p"),Re.textContent=bt,is=c(),_e=g("p"),_e.textContent=Ut,ms=c(),d(Ce.$$.fragment),rs=c(),q=g("div"),q.innerHTML=ht,os=c(),Qe=g("p"),Qe.innerHTML=gt,cs=c(),d(Xe.$$.fragment),ys=c(),d(ve.$$.fragment),Ms=c(),Ye=g("p"),Ye.innerHTML=Tt,ds=c(),d(Ne.$$.fragment),Js=c(),Fe=g("p"),Fe.textContent=kt,us=c(),d(He.$$.fragment),fs=c(),Ee=g("p"),Ee.innerHTML=Zt,bs=c(),d(ze.$$.fragment),Us=c(),L=g("div"),L.innerHTML=wt,hs=c(),d(Se.$$.fragment),gs=c(),xe=g("p"),xe.textContent=Wt,Ts=c(),Ke=g("ul"),Ke.innerHTML=jt,ks=c(),De=g("p"),De.innerHTML=$t,Zs=c(),d(qe.$$.fragment),ws=c(),Le=g("p"),Le.innerHTML=Vt,Ws=c(),d(Pe.$$.fragment),js=c(),Ae=g("p"),Ae.textContent=Gt,$s=c(),d(Oe.$$.fragment),Vs=c(),el=g("p"),el.innerHTML=Bt,Gs=c(),d(ll.$$.fragment),Bs=c(),P=g("div"),P.innerHTML=It,Is=c(),d(sl.$$.fragment),Rs=c(),tl=g("p"),tl.textContent=Rt,_s=c(),nl=g("ol"),nl.innerHTML=_t,Cs=c(),d(al.$$.fragment),Qs=c(),A=g("ol"),A.innerHTML=Ct,Xs=c(),d(pl.$$.fragment),vs=c(),il=g("p"),il.innerHTML=Qt,Ys=c(),d(ml.$$.fragment),Ns=c(),O=g("ol"),O.innerHTML=Xt,Fs=c(),d(rl.$$.fragment),Hs=c(),ee=g("ol"),ee.innerHTML=vt,Es=c(),d(ol.$$.fragment),zs=c(),d(cl.$$.fragment),Ss=c(),yl=g("p"),this.h()},l(e){const a=tn("svelte-u9bgzb",document.head);s=T(a,"META",{name:!0,content:!0}),a.forEach(p),m=y(e),l=T(e,"P",{}),At(l).forEach(p),o=y(e),J(t.$$.fragment,e),n=y(e),J(r.$$.fragment,e),M=y(e),W=T(e,"P",{"data-svelte-h":!0}),Z(W)!=="svelte-1bko70a"&&(W.textContent=G),k=y(e),$=T(e,"P",{"data-svelte-h":!0}),Z($)!=="svelte-18b8tlp"&&($.innerHTML=Ds),Ml=y(e),le=T(e,"P",{"data-svelte-h":!0}),Z(le)!=="svelte-1wcte0b"&&(le.innerHTML=qs),dl=y(e),se=T(e,"P",{"data-svelte-h":!0}),Z(se)!=="svelte-ckpv5f"&&(se.innerHTML=Ls),Jl=y(e),te=T(e,"P",{"data-svelte-h":!0}),Z(te)!=="svelte-1sy3nlp"&&(te.textContent=Ps),ul=y(e),ne=T(e,"P",{"data-svelte-h":!0}),Z(ne)!=="svelte-1dydg7a"&&(ne.textContent=As),fl=y(e),J(ae.$$.fragment,e),bl=y(e),J(_.$$.fragment,e),Ul=y(e),J(pe.$$.fragment,e),hl=y(e),ie=T(e,"P",{"data-svelte-h":!0}),Z(ie)!=="svelte-1sefbph"&&(ie.innerHTML=Os),gl=y(e),J(C.$$.fragment,e),Tl=y(e),me=T(e,"P",{"data-svelte-h":!0}),Z(me)!=="svelte-12j62dc"&&(me.innerHTML=et),kl=y(e),re=T(e,"P",{"data-svelte-h":!0}),Z(re)!=="svelte-pukajh"&&(re.innerHTML=lt),Zl=y(e),J(Q.$$.fragment,e),wl=y(e),J(oe.$$.fragment,e),Wl=y(e),ce=T(e,"P",{"data-svelte-h":!0}),Z(ce)!=="svelte-1aianu4"&&(ce.textContent=st),jl=y(e),J(X.$$.fragment,e),$l=y(e),ye=T(e,"P",{"data-svelte-h":!0}),Z(ye)!=="svelte-1eewmqm"&&(ye.textContent=tt),Vl=y(e),J(Me.$$.fragment,e),Gl=y(e),v=T(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(v)!=="svelte-1w2zk95"&&(v.innerHTML=nt),Bl=y(e),de=T(e,"P",{"data-svelte-h":!0}),Z(de)!=="svelte-1sj0kef"&&(de.innerHTML=at),Il=y(e),J(Je.$$.fragment,e),Rl=y(e),ue=T(e,"P",{"data-svelte-h":!0}),Z(ue)!=="svelte-1uxnltd"&&(ue.textContent=pt),_l=y(e),J(Y.$$.fragment,e),Cl=y(e),fe=T(e,"P",{"data-svelte-h":!0}),Z(fe)!=="svelte-hzxa8q"&&(fe.innerHTML=it),Ql=y(e),be=T(e,"P",{"data-svelte-h":!0}),Z(be)!=="svelte-12ry8vz"&&(be.innerHTML=mt),Xl=y(e),J(N.$$.fragment,e),vl=y(e),J(Ue.$$.fragment,e),Yl=y(e),J(F.$$.fragment,e),Nl=y(e),he=T(e,"P",{"data-svelte-h":!0}),Z(he)!=="svelte-qsp91m"&&(he.textContent=rt),Fl=y(e),J(H.$$.fragment,e),Hl=y(e),ge=T(e,"P",{"data-svelte-h":!0}),Z(ge)!=="svelte-1nfserr"&&(ge.textContent=ot),El=y(e),J(Te.$$.fragment,e),zl=y(e),ke=T(e,"P",{"data-svelte-h":!0}),Z(ke)!=="svelte-339bbm"&&(ke.textContent=ct),Sl=y(e),J(Ze.$$.fragment,e),xl=y(e),we=T(e,"P",{"data-svelte-h":!0}),Z(we)!=="svelte-dajjv4"&&(we.textContent=yt),Kl=y(e),J(E.$$.fragment,e),Dl=y(e),We=T(e,"P",{"data-svelte-h":!0}),Z(We)!=="svelte-y29dku"&&(We.innerHTML=Mt),ql=y(e),J(z.$$.fragment,e),Ll=y(e),J(je.$$.fragment,e),Pl=y(e),$e=T(e,"P",{"data-svelte-h":!0}),Z($e)!=="svelte-p80btz"&&($e.textContent=dt),Al=y(e),J(S.$$.fragment,e),Ol=y(e),x=T(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(x)!=="svelte-1c7h32m"&&(x.innerHTML=Jt),es=y(e),Ve=T(e,"P",{"data-svelte-h":!0}),Z(Ve)!=="svelte-1ct3lji"&&(Ve.textContent=ut),ls=y(e),J(Ge.$$.fragment,e),ss=y(e),Be=T(e,"P",{"data-svelte-h":!0}),Z(Be)!=="svelte-1rcm9me"&&(Be.innerHTML=ft),ts=y(e),J(K.$$.fragment,e),ns=y(e),J(Ie.$$.fragment,e),as=y(e),J(D.$$.fragment,e),ps=y(e),Re=T(e,"P",{"data-svelte-h":!0}),Z(Re)!=="svelte-re8j87"&&(Re.textContent=bt),is=y(e),_e=T(e,"P",{"data-svelte-h":!0}),Z(_e)!=="svelte-bnaxe4"&&(_e.textContent=Ut),ms=y(e),J(Ce.$$.fragment,e),rs=y(e),q=T(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(q)!=="svelte-11gtyyz"&&(q.innerHTML=ht),os=y(e),Qe=T(e,"P",{"data-svelte-h":!0}),Z(Qe)!=="svelte-1xmggyl"&&(Qe.innerHTML=gt),cs=y(e),J(Xe.$$.fragment,e),ys=y(e),J(ve.$$.fragment,e),Ms=y(e),Ye=T(e,"P",{"data-svelte-h":!0}),Z(Ye)!=="svelte-1c5fsic"&&(Ye.innerHTML=Tt),ds=y(e),J(Ne.$$.fragment,e),Js=y(e),Fe=T(e,"P",{"data-svelte-h":!0}),Z(Fe)!=="svelte-1ta47o3"&&(Fe.textContent=kt),us=y(e),J(He.$$.fragment,e),fs=y(e),Ee=T(e,"P",{"data-svelte-h":!0}),Z(Ee)!=="svelte-abo9el"&&(Ee.innerHTML=Zt),bs=y(e),J(ze.$$.fragment,e),Us=y(e),L=T(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(L)!=="svelte-1oo0se1"&&(L.innerHTML=wt),hs=y(e),J(Se.$$.fragment,e),gs=y(e),xe=T(e,"P",{"data-svelte-h":!0}),Z(xe)!=="svelte-1qtubr7"&&(xe.textContent=Wt),Ts=y(e),Ke=T(e,"UL",{"data-svelte-h":!0}),Z(Ke)!=="svelte-6td1jn"&&(Ke.innerHTML=jt),ks=y(e),De=T(e,"P",{"data-svelte-h":!0}),Z(De)!=="svelte-ya90bw"&&(De.innerHTML=$t),Zs=y(e),J(qe.$$.fragment,e),ws=y(e),Le=T(e,"P",{"data-svelte-h":!0}),Z(Le)!=="svelte-1mw2wdw"&&(Le.innerHTML=Vt),Ws=y(e),J(Pe.$$.fragment,e),js=y(e),Ae=T(e,"P",{"data-svelte-h":!0}),Z(Ae)!=="svelte-7am2u1"&&(Ae.textContent=Gt),$s=y(e),J(Oe.$$.fragment,e),Vs=y(e),el=T(e,"P",{"data-svelte-h":!0}),Z(el)!=="svelte-yn34s8"&&(el.innerHTML=Bt),Gs=y(e),J(ll.$$.fragment,e),Bs=y(e),P=T(e,"DIV",{class:!0,"data-svelte-h":!0}),Z(P)!=="svelte-eey5ka"&&(P.innerHTML=It),Is=y(e),J(sl.$$.fragment,e),Rs=y(e),tl=T(e,"P",{"data-svelte-h":!0}),Z(tl)!=="svelte-1wfpj8q"&&(tl.textContent=Rt),_s=y(e),nl=T(e,"OL",{"data-svelte-h":!0}),Z(nl)!=="svelte-6zsdp2"&&(nl.innerHTML=_t),Cs=y(e),J(al.$$.fragment,e),Qs=y(e),A=T(e,"OL",{start:!0,"data-svelte-h":!0}),Z(A)!=="svelte-1g7sf05"&&(A.innerHTML=Ct),Xs=y(e),J(pl.$$.fragment,e),vs=y(e),il=T(e,"P",{"data-svelte-h":!0}),Z(il)!=="svelte-sptkvy"&&(il.innerHTML=Qt),Ys=y(e),J(ml.$$.fragment,e),Ns=y(e),O=T(e,"OL",{start:!0,"data-svelte-h":!0}),Z(O)!=="svelte-12qj1et"&&(O.innerHTML=Xt),Fs=y(e),J(rl.$$.fragment,e),Hs=y(e),ee=T(e,"OL",{start:!0,"data-svelte-h":!0}),Z(ee)!=="svelte-1y5yjap"&&(ee.innerHTML=vt),Es=y(e),J(ol.$$.fragment,e),zs=y(e),J(cl.$$.fragment,e),Ss=y(e),yl=T(e,"P",{}),At(yl).forEach(p),this.h()},h(){B(s,"name","hf:doc:metadata"),B(s,"content",Sn),B(v,"class","flex justify-center"),B(x,"class","flex gap-4"),B(q,"class","flex justify-center"),B(L,"class","flex justify-center"),B(P,"class","flex justify-center"),B(A,"start","2"),B(O,"start","3"),B(ee,"start","4")},m(e,a){nn(document.head,s),i(e,m,a),i(e,l,a),i(e,o,a),u(t,e,a),i(e,n,a),u(r,e,a),i(e,M,a),i(e,W,a),i(e,k,a),i(e,$,a),i(e,Ml,a),i(e,le,a),i(e,dl,a),i(e,se,a),i(e,Jl,a),i(e,te,a),i(e,ul,a),i(e,ne,a),i(e,fl,a),u(ae,e,a),i(e,bl,a),u(_,e,a),i(e,Ul,a),u(pe,e,a),i(e,hl,a),i(e,ie,a),i(e,gl,a),u(C,e,a),i(e,Tl,a),i(e,me,a),i(e,kl,a),i(e,re,a),i(e,Zl,a),u(Q,e,a),i(e,wl,a),u(oe,e,a),i(e,Wl,a),i(e,ce,a),i(e,jl,a),u(X,e,a),i(e,$l,a),i(e,ye,a),i(e,Vl,a),u(Me,e,a),i(e,Gl,a),i(e,v,a),i(e,Bl,a),i(e,de,a),i(e,Il,a),u(Je,e,a),i(e,Rl,a),i(e,ue,a),i(e,_l,a),u(Y,e,a),i(e,Cl,a),i(e,fe,a),i(e,Ql,a),i(e,be,a),i(e,Xl,a),u(N,e,a),i(e,vl,a),u(Ue,e,a),i(e,Yl,a),u(F,e,a),i(e,Nl,a),i(e,he,a),i(e,Fl,a),u(H,e,a),i(e,Hl,a),i(e,ge,a),i(e,El,a),u(Te,e,a),i(e,zl,a),i(e,ke,a),i(e,Sl,a),u(Ze,e,a),i(e,xl,a),i(e,we,a),i(e,Kl,a),u(E,e,a),i(e,Dl,a),i(e,We,a),i(e,ql,a),u(z,e,a),i(e,Ll,a),u(je,e,a),i(e,Pl,a),i(e,$e,a),i(e,Al,a),u(S,e,a),i(e,Ol,a),i(e,x,a),i(e,es,a),i(e,Ve,a),i(e,ls,a),u(Ge,e,a),i(e,ss,a),i(e,Be,a),i(e,ts,a),u(K,e,a),i(e,ns,a),u(Ie,e,a),i(e,as,a),u(D,e,a),i(e,ps,a),i(e,Re,a),i(e,is,a),i(e,_e,a),i(e,ms,a),u(Ce,e,a),i(e,rs,a),i(e,q,a),i(e,os,a),i(e,Qe,a),i(e,cs,a),u(Xe,e,a),i(e,ys,a),u(ve,e,a),i(e,Ms,a),i(e,Ye,a),i(e,ds,a),u(Ne,e,a),i(e,Js,a),i(e,Fe,a),i(e,us,a),u(He,e,a),i(e,fs,a),i(e,Ee,a),i(e,bs,a),u(ze,e,a),i(e,Us,a),i(e,L,a),i(e,hs,a),u(Se,e,a),i(e,gs,a),i(e,xe,a),i(e,Ts,a),i(e,Ke,a),i(e,ks,a),i(e,De,a),i(e,Zs,a),u(qe,e,a),i(e,ws,a),i(e,Le,a),i(e,Ws,a),u(Pe,e,a),i(e,js,a),i(e,Ae,a),i(e,$s,a),u(Oe,e,a),i(e,Vs,a),i(e,el,a),i(e,Gs,a),u(ll,e,a),i(e,Bs,a),i(e,P,a),i(e,Is,a),u(sl,e,a),i(e,Rs,a),i(e,tl,a),i(e,_s,a),i(e,nl,a),i(e,Cs,a),u(al,e,a),i(e,Qs,a),i(e,A,a),i(e,Xs,a),u(pl,e,a),i(e,vs,a),i(e,il,a),i(e,Ys,a),u(ml,e,a),i(e,Ns,a),i(e,O,a),i(e,Fs,a),u(rl,e,a),i(e,Hs,a),i(e,ee,a),i(e,Es,a),u(ol,e,a),i(e,zs,a),u(cl,e,a),i(e,Ss,a),i(e,yl,a),xs=!0},p(e,[a]){const Yt={};a&2&&(Yt.$$scope={dirty:a,ctx:e}),_.$set(Yt);const Nt={};a&2&&(Nt.$$scope={dirty:a,ctx:e}),C.$set(Nt);const Ft={};a&2&&(Ft.$$scope={dirty:a,ctx:e}),Q.$set(Ft);const Ht={};a&2&&(Ht.$$scope={dirty:a,ctx:e}),X.$set(Ht);const Et={};a&2&&(Et.$$scope={dirty:a,ctx:e}),Y.$set(Et);const zt={};a&2&&(zt.$$scope={dirty:a,ctx:e}),N.$set(zt);const St={};a&2&&(St.$$scope={dirty:a,ctx:e}),F.$set(St);const xt={};a&2&&(xt.$$scope={dirty:a,ctx:e}),H.$set(xt);const Kt={};a&2&&(Kt.$$scope={dirty:a,ctx:e}),E.$set(Kt);const Dt={};a&2&&(Dt.$$scope={dirty:a,ctx:e}),z.$set(Dt);const qt={};a&2&&(qt.$$scope={dirty:a,ctx:e}),S.$set(qt);const Lt={};a&2&&(Lt.$$scope={dirty:a,ctx:e}),K.$set(Lt);const Pt={};a&2&&(Pt.$$scope={dirty:a,ctx:e}),D.$set(Pt)},i(e){xs||(f(t.$$.fragment,e),f(r.$$.fragment,e),f(ae.$$.fragment,e),f(_.$$.fragment,e),f(pe.$$.fragment,e),f(C.$$.fragment,e),f(Q.$$.fragment,e),f(oe.$$.fragment,e),f(X.$$.fragment,e),f(Me.$$.fragment,e),f(Je.$$.fragment,e),f(Y.$$.fragment,e),f(N.$$.fragment,e),f(Ue.$$.fragment,e),f(F.$$.fragment,e),f(H.$$.fragment,e),f(Te.$$.fragment,e),f(Ze.$$.fragment,e),f(E.$$.fragment,e),f(z.$$.fragment,e),f(je.$$.fragment,e),f(S.$$.fragment,e),f(Ge.$$.fragment,e),f(K.$$.fragment,e),f(Ie.$$.fragment,e),f(D.$$.fragment,e),f(Ce.$$.fragment,e),f(Xe.$$.fragment,e),f(ve.$$.fragment,e),f(Ne.$$.fragment,e),f(He.$$.fragment,e),f(ze.$$.fragment,e),f(Se.$$.fragment,e),f(qe.$$.fragment,e),f(Pe.$$.fragment,e),f(Oe.$$.fragment,e),f(ll.$$.fragment,e),f(sl.$$.fragment,e),f(al.$$.fragment,e),f(pl.$$.fragment,e),f(ml.$$.fragment,e),f(rl.$$.fragment,e),f(ol.$$.fragment,e),f(cl.$$.fragment,e),xs=!0)},o(e){b(t.$$.fragment,e),b(r.$$.fragment,e),b(ae.$$.fragment,e),b(_.$$.fragment,e),b(pe.$$.fragment,e),b(C.$$.fragment,e),b(Q.$$.fragment,e),b(oe.$$.fragment,e),b(X.$$.fragment,e),b(Me.$$.fragment,e),b(Je.$$.fragment,e),b(Y.$$.fragment,e),b(N.$$.fragment,e),b(Ue.$$.fragment,e),b(F.$$.fragment,e),b(H.$$.fragment,e),b(Te.$$.fragment,e),b(Ze.$$.fragment,e),b(E.$$.fragment,e),b(z.$$.fragment,e),b(je.$$.fragment,e),b(S.$$.fragment,e),b(Ge.$$.fragment,e),b(K.$$.fragment,e),b(Ie.$$.fragment,e),b(D.$$.fragment,e),b(Ce.$$.fragment,e),b(Xe.$$.fragment,e),b(ve.$$.fragment,e),b(Ne.$$.fragment,e),b(He.$$.fragment,e),b(ze.$$.fragment,e),b(Se.$$.fragment,e),b(qe.$$.fragment,e),b(Pe.$$.fragment,e),b(Oe.$$.fragment,e),b(ll.$$.fragment,e),b(sl.$$.fragment,e),b(al.$$.fragment,e),b(pl.$$.fragment,e),b(ml.$$.fragment,e),b(rl.$$.fragment,e),b(ol.$$.fragment,e),b(cl.$$.fragment,e),xs=!1},d(e){e&&(p(m),p(l),p(o),p(n),p(M),p(W),p(k),p($),p(Ml),p(le),p(dl),p(se),p(Jl),p(te),p(ul),p(ne),p(fl),p(bl),p(Ul),p(hl),p(ie),p(gl),p(Tl),p(me),p(kl),p(re),p(Zl),p(wl),p(Wl),p(ce),p(jl),p($l),p(ye),p(Vl),p(Gl),p(v),p(Bl),p(de),p(Il),p(Rl),p(ue),p(_l),p(Cl),p(fe),p(Ql),p(be),p(Xl),p(vl),p(Yl),p(Nl),p(he),p(Fl),p(Hl),p(ge),p(El),p(zl),p(ke),p(Sl),p(xl),p(we),p(Kl),p(Dl),p(We),p(ql),p(Ll),p(Pl),p($e),p(Al),p(Ol),p(x),p(es),p(Ve),p(ls),p(ss),p(Be),p(ts),p(ns),p(as),p(ps),p(Re),p(is),p(_e),p(ms),p(rs),p(q),p(os),p(Qe),p(cs),p(ys),p(Ms),p(Ye),p(ds),p(Js),p(Fe),p(us),p(fs),p(Ee),p(bs),p(Us),p(L),p(hs),p(gs),p(xe),p(Ts),p(Ke),p(ks),p(De),p(Zs),p(ws),p(Le),p(Ws),p(js),p(Ae),p($s),p(Vs),p(el),p(Gs),p(Bs),p(P),p(Is),p(Rs),p(tl),p(_s),p(nl),p(Cs),p(Qs),p(A),p(Xs),p(vs),p(il),p(Ys),p(Ns),p(O),p(Fs),p(Hs),p(ee),p(Es),p(zs),p(Ss),p(yl)),p(s),U(t,e),U(r,e),U(ae,e),U(_,e),U(pe,e),U(C,e),U(Q,e),U(oe,e),U(X,e),U(Me,e),U(Je,e),U(Y,e),U(N,e),U(Ue,e),U(F,e),U(H,e),U(Te,e),U(Ze,e),U(E,e),U(z,e),U(je,e),U(S,e),U(Ge,e),U(K,e),U(Ie,e),U(D,e),U(Ce,e),U(Xe,e),U(ve,e),U(Ne,e),U(He,e),U(ze,e),U(Se,e),U(qe,e),U(Pe,e),U(Oe,e),U(ll,e),U(sl,e),U(al,e),U(pl,e),U(ml,e),U(rl,e),U(ol,e),U(cl,e)}}}const Sn='{"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":"최적화","local":"최적화","sections":[],"depth":2}],"depth":1}';function xn(h){return en(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ea extends ln{constructor(s){super(),sn(this,s,xn,zn,Ot,{})}}export{ea as component};
