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