import{s as V,j as K,n as O,o as ee}from"../chunks/scheduler.6e0d5ff7.js";import{S as te,i as ae,g as p,s as l,r as H,E as se,h as m,f as a,c as o,j as C,u as G,x as T,k as w,y as le,a as s,v as x,d as S,t as D,w as F}from"../chunks/index.d7c1b260.js";import{C as z}from"../chunks/CodeBlock.09a08494.js";import{D as oe}from"../chunks/DocNotebookDropdown.0647ce65.js";import{H as ie}from"../chunks/Heading.30a009b0.js";function ne(L){let n,J,y,_,r,k,d,B,c,P='<code>StableDiffusionDepth2ImgPipeline</code>을 사용하면 텍스트 프롬프트와 초기 이미지를 전달하여 새 이미지의 생성을 조절할 수 있습니다. 또한 이미지 구조를 보존하기 위해 <code>depth_map</code>을 전달할 수도 있습니다. <code>depth_map</code>이 제공되지 않으면 파이프라인은 통합된 <a href="https://github.com/isl-org/MiDaS" rel="nofollow">depth-estimation model</a>을 통해 자동으로 깊이를 예측합니다.',v,u,R="먼저 <code>StableDiffusionDepth2ImgPipeline</code>의 인스턴스를 생성합니다:",Z,h,$,g,N="이제 프롬프트를 파이프라인에 전달합니다. 특정 단어가 이미지 생성을 가이드 하는것을 방지하기 위해 <code>negative_prompt</code>를 전달할 수도 있습니다:",U,b,W,f,Y='<thead><tr><th>Input</th> <th>Output</th></tr></thead> <tbody><tr><td><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/coco-cats.png" width="500"/></td> <td><img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/depth2img-tigers.png" width="500"/></td></tr></tbody>',I,M,q="아래의 Spaces를 가지고 놀며 depth map이 있는 이미지와 없는 이미지의 차이가 있는지 확인해 보세요!",Q,i,A,X,j,E;return r=new ie({props:{title:"Text-guided depth-to-image 생성",local:"text-guided-depth-to-image-생성",headingTag:"h1"}}),d=new oe({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/depth2img.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/depth2img.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/depth2img.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/depth2img.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/depth2img.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/depth2img.ipynb"}]}}),h=new z({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBTdGFibGVEaWZmdXNpb25EZXB0aDJJbWdQaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25EZXB0aDJJbWdQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItZGVwdGglMjIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMEEpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> requests
<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> StableDiffusionDepth2ImgPipeline

pipe = StableDiffusionDepth2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-2-depth&quot;</span>,
    torch_dtype=torch.float16,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),b=new z({props:{code:"dXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWluaXRfaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBcHJvbXB0JTIwJTNEJTIwJTIydHdvJTIwdGlnZXJzJTIyJTBBbl9wcm9tcHQlMjAlM0QlMjAlMjJiYWQlMkMlMjBkZWZvcm1lZCUyQyUyMHVnbHklMkMlMjBiYWQlMjBhbmF0b215JTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEaW5pdF9pbWFnZSUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5fcHJvbXB0JTJDJTIwc3RyZW5ndGglM0QwLjcpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
init_image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
prompt = <span class="hljs-string">&quot;two tigers&quot;</span>
n_prompt = <span class="hljs-string">&quot;bad, deformed, ugly, bad anatomy&quot;</span>
image = pipe(prompt=prompt, image=init_image, negative_prompt=n_prompt, strength=<span class="hljs-number">0.7</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){n=p("meta"),J=l(),y=p("p"),_=l(),H(r.$$.fragment),k=l(),H(d.$$.fragment),B=l(),c=p("p"),c.innerHTML=P,v=l(),u=p("p"),u.innerHTML=R,Z=l(),H(h.$$.fragment),$=l(),g=p("p"),g.innerHTML=N,U=l(),H(b.$$.fragment),W=l(),f=p("table"),f.innerHTML=Y,I=l(),M=p("p"),M.textContent=q,Q=l(),i=p("iframe"),X=l(),j=p("p"),this.h()},l(e){const t=se("svelte-u9bgzb",document.head);n=m(t,"META",{name:!0,content:!0}),t.forEach(a),J=o(e),y=m(e,"P",{}),C(y).forEach(a),_=o(e),G(r.$$.fragment,e),k=o(e),G(d.$$.fragment,e),B=o(e),c=m(e,"P",{"data-svelte-h":!0}),T(c)!=="svelte-1nwb6xh"&&(c.innerHTML=P),v=o(e),u=m(e,"P",{"data-svelte-h":!0}),T(u)!=="svelte-b7rzk"&&(u.innerHTML=R),Z=o(e),G(h.$$.fragment,e),$=o(e),g=m(e,"P",{"data-svelte-h":!0}),T(g)!=="svelte-1ospw27"&&(g.innerHTML=N),U=o(e),G(b.$$.fragment,e),W=o(e),f=m(e,"TABLE",{"data-svelte-h":!0}),T(f)!=="svelte-175x2as"&&(f.innerHTML=Y),I=o(e),M=m(e,"P",{"data-svelte-h":!0}),T(M)!=="svelte-1vexnbo"&&(M.textContent=q),Q=o(e),i=m(e,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),C(i).forEach(a),X=o(e),j=m(e,"P",{}),C(j).forEach(a),this.h()},h(){w(n,"name","hf:doc:metadata"),w(n,"content",pe),K(i.src,A="https://radames-stable-diffusion-depth2img.hf.space")||w(i,"src",A),w(i,"frameborder","0"),w(i,"width","850"),w(i,"height","500")},m(e,t){le(document.head,n),s(e,J,t),s(e,y,t),s(e,_,t),x(r,e,t),s(e,k,t),x(d,e,t),s(e,B,t),s(e,c,t),s(e,v,t),s(e,u,t),s(e,Z,t),x(h,e,t),s(e,$,t),s(e,g,t),s(e,U,t),x(b,e,t),s(e,W,t),s(e,f,t),s(e,I,t),s(e,M,t),s(e,Q,t),s(e,i,t),s(e,X,t),s(e,j,t),E=!0},p:O,i(e){E||(S(r.$$.fragment,e),S(d.$$.fragment,e),S(h.$$.fragment,e),S(b.$$.fragment,e),E=!0)},o(e){D(r.$$.fragment,e),D(d.$$.fragment,e),D(h.$$.fragment,e),D(b.$$.fragment,e),E=!1},d(e){e&&(a(J),a(y),a(_),a(k),a(B),a(c),a(v),a(u),a(Z),a($),a(g),a(U),a(W),a(f),a(I),a(M),a(Q),a(i),a(X),a(j)),a(n),F(r,e),F(d,e),F(h,e),F(b,e)}}}const pe='{"title":"Text-guided depth-to-image 생성","local":"text-guided-depth-to-image-생성","sections":[],"depth":1}';function me(L){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ge extends te{constructor(n){super(),ae(this,n,me,ne,V,{})}}export{ge as component};
