import{s as ce,j as ge,n as he,o as de}from"../chunks/scheduler.6e0d5ff7.js";import{S as be,i as _e,g as n,s as a,r as P,E as $e,h as o,f as l,c as i,j as te,u as j,x as m,k as x,y as we,a as s,v as Z,d as C,t as J,w as U}from"../chunks/index.d7c1b260.js";import{C as ee}from"../chunks/CodeBlock.09a08494.js";import{D as ye}from"../chunks/DocNotebookDropdown.b1b23d60.js";import{H as ve}from"../chunks/Heading.30a009b0.js";function Me(le){let r,H,G,I,f,W,u,q,c,se="조건부 이미지 생성을 사용하면 텍스트 프롬프트에서 이미지를 생성할 수 있습니다. 텍스트는 임베딩으로 변환되며, 임베딩은 노이즈에서 이미지를 생성하도록 모델을 조건화하는 데 사용됩니다.",V,g,ae="<code>DiffusionPipeline</code>은 추론을 위해 사전 훈련된 diffusion 시스템을 사용하는 가장 쉬운 방법입니다.",D,h,ie='먼저 <code>DiffusionPipeline</code>의 인스턴스를 생성하고 다운로드할 파이프라인 <a href="https://huggingface.co/models?library=diffusers&amp;sort=downloads" rel="nofollow">체크포인트</a>를 지정합니다.',B,d,ne='이 가이드에서는 <a href="https://huggingface.co/CompVis/ldm-text2im-large-256" rel="nofollow">잠재 Diffusion</a>과 함께 텍스트-이미지 생성에 <code>DiffusionPipeline</code>을 사용합니다:',E,b,N,_,oe=`<code>DiffusionPipeline</code>은 모든 모델링, 토큰화, 스케줄링 구성 요소를 다운로드하고 캐시합니다.
이 모델은 약 14억 개의 파라미터로 구성되어 있기 때문에 GPU에서 실행할 것을 강력히 권장합니다.
PyTorch에서와 마찬가지로 생성기 객체를 GPU로 이동할 수 있습니다:`,F,$,S,w,pe="이제 텍스트 프롬프트에서 <code>생성기</code>를 사용할 수 있습니다:",R,y,X,v,re='출력값은 기본적으로 <a href="https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class" rel="nofollow"><code>PIL.Image</code></a> 객체로 래핑됩니다.',z,M,me="호출하여 이미지를 저장할 수 있습니다:",A,k,Q,T,fe="아래 스페이스를 사용해보고 안내 배율 매개변수를 자유롭게 조정하여 이미지 품질에 어떤 영향을 미치는지 확인해 보세요!",Y,p,ue,K,L,O;return f=new ve({props:{title:"조건부 이미지 생성",local:"조건부-이미지-생성",headingTag:"h1"}}),u=new ye({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"}]}}),b=new ee({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 ee({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 ee({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 ee({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}}),{c(){r=n("meta"),H=a(),G=n("p"),I=a(),P(f.$$.fragment),W=a(),P(u.$$.fragment),q=a(),c=n("p"),c.textContent=se,V=a(),g=n("p"),g.innerHTML=ae,D=a(),h=n("p"),h.innerHTML=ie,B=a(),d=n("p"),d.innerHTML=ne,E=a(),P(b.$$.fragment),N=a(),_=n("p"),_.innerHTML=oe,F=a(),P($.$$.fragment),S=a(),w=n("p"),w.innerHTML=pe,R=a(),P(y.$$.fragment),X=a(),v=n("p"),v.innerHTML=re,z=a(),M=n("p"),M.textContent=me,A=a(),P(k.$$.fragment),Q=a(),T=n("p"),T.textContent=fe,Y=a(),p=n("iframe"),K=a(),L=n("p"),this.h()},l(e){const t=$e("svelte-u9bgzb",document.head);r=o(t,"META",{name:!0,content:!0}),t.forEach(l),H=i(e),G=o(e,"P",{}),te(G).forEach(l),I=i(e),j(f.$$.fragment,e),W=i(e),j(u.$$.fragment,e),q=i(e),c=o(e,"P",{"data-svelte-h":!0}),m(c)!=="svelte-ywp3eh"&&(c.textContent=se),V=i(e),g=o(e,"P",{"data-svelte-h":!0}),m(g)!=="svelte-rsjwii"&&(g.innerHTML=ae),D=i(e),h=o(e,"P",{"data-svelte-h":!0}),m(h)!=="svelte-16j05gn"&&(h.innerHTML=ie),B=i(e),d=o(e,"P",{"data-svelte-h":!0}),m(d)!=="svelte-1zljx"&&(d.innerHTML=ne),E=i(e),j(b.$$.fragment,e),N=i(e),_=o(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-1swfe66"&&(_.innerHTML=oe),F=i(e),j($.$$.fragment,e),S=i(e),w=o(e,"P",{"data-svelte-h":!0}),m(w)!=="svelte-yx8neo"&&(w.innerHTML=pe),R=i(e),j(y.$$.fragment,e),X=i(e),v=o(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-kfigs4"&&(v.innerHTML=re),z=i(e),M=o(e,"P",{"data-svelte-h":!0}),m(M)!=="svelte-1qprq36"&&(M.textContent=me),A=i(e),j(k.$$.fragment,e),Q=i(e),T=o(e,"P",{"data-svelte-h":!0}),m(T)!=="svelte-1av7pf"&&(T.textContent=fe),Y=i(e),p=o(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),te(p).forEach(l),K=i(e),L=o(e,"P",{}),te(L).forEach(l),this.h()},h(){x(r,"name","hf:doc:metadata"),x(r,"content",ke),ge(p.src,ue="https://stabilityai-stable-diffusion.hf.space")||x(p,"src",ue),x(p,"frameborder","0"),x(p,"width","850"),x(p,"height","500")},m(e,t){we(document.head,r),s(e,H,t),s(e,G,t),s(e,I,t),Z(f,e,t),s(e,W,t),Z(u,e,t),s(e,q,t),s(e,c,t),s(e,V,t),s(e,g,t),s(e,D,t),s(e,h,t),s(e,B,t),s(e,d,t),s(e,E,t),Z(b,e,t),s(e,N,t),s(e,_,t),s(e,F,t),Z($,e,t),s(e,S,t),s(e,w,t),s(e,R,t),Z(y,e,t),s(e,X,t),s(e,v,t),s(e,z,t),s(e,M,t),s(e,A,t),Z(k,e,t),s(e,Q,t),s(e,T,t),s(e,Y,t),s(e,p,t),s(e,K,t),s(e,L,t),O=!0},p:he,i(e){O||(C(f.$$.fragment,e),C(u.$$.fragment,e),C(b.$$.fragment,e),C($.$$.fragment,e),C(y.$$.fragment,e),C(k.$$.fragment,e),O=!0)},o(e){J(f.$$.fragment,e),J(u.$$.fragment,e),J(b.$$.fragment,e),J($.$$.fragment,e),J(y.$$.fragment,e),J(k.$$.fragment,e),O=!1},d(e){e&&(l(H),l(G),l(I),l(W),l(q),l(c),l(V),l(g),l(D),l(h),l(B),l(d),l(E),l(N),l(_),l(F),l(S),l(w),l(R),l(X),l(v),l(z),l(M),l(A),l(Q),l(T),l(Y),l(p),l(K),l(L)),l(r),U(f,e),U(u,e),U(b,e),U($,e),U(y,e),U(k,e)}}}const ke='{"title":"조건부 이미지 생성","local":"조건부-이미지-생성","sections":[],"depth":1}';function Te(le){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Je extends be{constructor(r){super(),_e(this,r,Te,Me,ce,{})}}export{Je as component};
