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