import{s as be,j as de,n as he,o as $e}from"../chunks/scheduler.6e0d5ff7.js";import{S as _e,i as we,g as n,s as i,r as j,E as ye,h as o,f as s,c as a,j as le,u as x,x as m,k as U,y as ve,a as l,v as Z,d as C,t as G,w as J}from"../chunks/index.d7c1b260.js";import{C as se}from"../chunks/CodeBlock.09a08494.js";import{D as Me}from"../chunks/DocNotebookDropdown.b1b23d60.js";import{H as ke,E as Te}from"../chunks/EditOnGithub.733546da.js";function Pe(ie){let r,I,L,W,f,q,u,V,g,ae="조건부 이미지 생성을 사용하면 텍스트 프롬프트에서 이미지를 생성할 수 있습니다. 텍스트는 임베딩으로 변환되며, 임베딩은 노이즈에서 이미지를 생성하도록 모델을 조건화하는 데 사용됩니다.",E,c,ne="<code>DiffusionPipeline</code>은 추론을 위해 사전 훈련된 diffusion 시스템을 사용하는 가장 쉬운 방법입니다.",D,b,oe='먼저 <code>DiffusionPipeline</code>의 인스턴스를 생성하고 다운로드할 파이프라인 <a href="https://huggingface.co/models?library=diffusers&amp;sort=downloads" rel="nofollow">체크포인트</a>를 지정합니다.',B,d,pe='이 가이드에서는 <a href="https://huggingface.co/CompVis/ldm-text2im-large-256" rel="nofollow">잠재 Diffusion</a>과 함께 텍스트-이미지 생성에 <code>DiffusionPipeline</code>을 사용합니다:',N,h,F,$,re=`<code>DiffusionPipeline</code>은 모든 모델링, 토큰화, 스케줄링 구성 요소를 다운로드하고 캐시합니다.
이 모델은 약 14억 개의 파라미터로 구성되어 있기 때문에 GPU에서 실행할 것을 강력히 권장합니다.
PyTorch에서와 마찬가지로 생성기 객체를 GPU로 이동할 수 있습니다:`,S,_,R,w,me="이제 텍스트 프롬프트에서 <code>생성기</code>를 사용할 수 있습니다:",X,y,z,v,fe='출력값은 기본적으로 <a href="https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class" rel="nofollow"><code>PIL.Image</code></a> 객체로 래핑됩니다.',A,M,ue="호출하여 이미지를 저장할 수 있습니다:",Q,k,Y,T,ge="아래 스페이스를 사용해보고 안내 배율 매개변수를 자유롭게 조정하여 이미지 품질에 어떤 영향을 미치는지 확인해 보세요!",K,p,ce,O,P,ee,H,te;return f=new ke({props:{title:"조건부 이미지 생성",local:"조건부-이미지-생성",headingTag:"h1"}}),u=new Me({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/conditional_image_generation.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/conditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/conditional_image_generation.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/conditional_image_generation.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/conditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/conditional_image_generation.ipynb"}]}}),h=new se({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkNvbXBWaXMlMkZsZG0tdGV4dDJpbS1sYXJnZS0yNTYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>generator = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;CompVis/ldm-text2im-large-256&quot;</span>)`,wrap:!1}}),_=new se({props:{code:"Z2VuZXJhdG9yLnRvKCUyMmN1ZGElMjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>generator.to(<span class="hljs-string">&quot;cuda&quot;</span>)',wrap:!1}}),y=new se({props:{code:"aW1hZ2UlMjAlM0QlMjBnZW5lcmF0b3IoJTIyQW4lMjBpbWFnZSUyMG9mJTIwYSUyMHNxdWlycmVsJTIwaW4lMjBQaWNhc3NvJTIwc3R5bGUlMjIpLmltYWdlcyU1QjAlNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>image = generator(<span class="hljs-string">&quot;An image of a squirrel in Picasso style&quot;</span>).images[<span class="hljs-number">0</span>]',wrap:!1}}),k=new se({props:{code:"aW1hZ2Uuc2F2ZSglMjJpbWFnZV9vZl9zcXVpcnJlbF9wYWludGluZy5wbmclMjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;image_of_squirrel_painting.png&quot;</span>)',wrap:!1}}),P=new Te({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/using-diffusers/conditional_image_generation.md"}}),{c(){r=n("meta"),I=i(),L=n("p"),W=i(),j(f.$$.fragment),q=i(),j(u.$$.fragment),V=i(),g=n("p"),g.textContent=ae,E=i(),c=n("p"),c.innerHTML=ne,D=i(),b=n("p"),b.innerHTML=oe,B=i(),d=n("p"),d.innerHTML=pe,N=i(),j(h.$$.fragment),F=i(),$=n("p"),$.innerHTML=re,S=i(),j(_.$$.fragment),R=i(),w=n("p"),w.innerHTML=me,X=i(),j(y.$$.fragment),z=i(),v=n("p"),v.innerHTML=fe,A=i(),M=n("p"),M.textContent=ue,Q=i(),j(k.$$.fragment),Y=i(),T=n("p"),T.textContent=ge,K=i(),p=n("iframe"),O=i(),j(P.$$.fragment),ee=i(),H=n("p"),this.h()},l(e){const t=ye("svelte-u9bgzb",document.head);r=o(t,"META",{name:!0,content:!0}),t.forEach(s),I=a(e),L=o(e,"P",{}),le(L).forEach(s),W=a(e),x(f.$$.fragment,e),q=a(e),x(u.$$.fragment,e),V=a(e),g=o(e,"P",{"data-svelte-h":!0}),m(g)!=="svelte-ywp3eh"&&(g.textContent=ae),E=a(e),c=o(e,"P",{"data-svelte-h":!0}),m(c)!=="svelte-rsjwii"&&(c.innerHTML=ne),D=a(e),b=o(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-16j05gn"&&(b.innerHTML=oe),B=a(e),d=o(e,"P",{"data-svelte-h":!0}),m(d)!=="svelte-1zljx"&&(d.innerHTML=pe),N=a(e),x(h.$$.fragment,e),F=a(e),$=o(e,"P",{"data-svelte-h":!0}),m($)!=="svelte-1swfe66"&&($.innerHTML=re),S=a(e),x(_.$$.fragment,e),R=a(e),w=o(e,"P",{"data-svelte-h":!0}),m(w)!=="svelte-yx8neo"&&(w.innerHTML=me),X=a(e),x(y.$$.fragment,e),z=a(e),v=o(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-kfigs4"&&(v.innerHTML=fe),A=a(e),M=o(e,"P",{"data-svelte-h":!0}),m(M)!=="svelte-1qprq36"&&(M.textContent=ue),Q=a(e),x(k.$$.fragment,e),Y=a(e),T=o(e,"P",{"data-svelte-h":!0}),m(T)!=="svelte-1av7pf"&&(T.textContent=ge),K=a(e),p=o(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),le(p).forEach(s),O=a(e),x(P.$$.fragment,e),ee=a(e),H=o(e,"P",{}),le(H).forEach(s),this.h()},h(){U(r,"name","hf:doc:metadata"),U(r,"content",je),de(p.src,ce="https://stabilityai-stable-diffusion.hf.space")||U(p,"src",ce),U(p,"frameborder","0"),U(p,"width","850"),U(p,"height","500")},m(e,t){ve(document.head,r),l(e,I,t),l(e,L,t),l(e,W,t),Z(f,e,t),l(e,q,t),Z(u,e,t),l(e,V,t),l(e,g,t),l(e,E,t),l(e,c,t),l(e,D,t),l(e,b,t),l(e,B,t),l(e,d,t),l(e,N,t),Z(h,e,t),l(e,F,t),l(e,$,t),l(e,S,t),Z(_,e,t),l(e,R,t),l(e,w,t),l(e,X,t),Z(y,e,t),l(e,z,t),l(e,v,t),l(e,A,t),l(e,M,t),l(e,Q,t),Z(k,e,t),l(e,Y,t),l(e,T,t),l(e,K,t),l(e,p,t),l(e,O,t),Z(P,e,t),l(e,ee,t),l(e,H,t),te=!0},p:he,i(e){te||(C(f.$$.fragment,e),C(u.$$.fragment,e),C(h.$$.fragment,e),C(_.$$.fragment,e),C(y.$$.fragment,e),C(k.$$.fragment,e),C(P.$$.fragment,e),te=!0)},o(e){G(f.$$.fragment,e),G(u.$$.fragment,e),G(h.$$.fragment,e),G(_.$$.fragment,e),G(y.$$.fragment,e),G(k.$$.fragment,e),G(P.$$.fragment,e),te=!1},d(e){e&&(s(I),s(L),s(W),s(q),s(V),s(g),s(E),s(c),s(D),s(b),s(B),s(d),s(N),s(F),s($),s(S),s(R),s(w),s(X),s(z),s(v),s(A),s(M),s(Q),s(Y),s(T),s(K),s(p),s(O),s(ee),s(H)),s(r),J(f,e),J(u,e),J(h,e),J(_,e),J(y,e),J(k,e),J(P,e)}}}const je='{"title":"조건부 이미지 생성","local":"조건부-이미지-생성","sections":[],"depth":1}';function xe(ie){return $e(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Le extends _e{constructor(r){super(),we(this,r,xe,Pe,be,{})}}export{Le as component};
