import{S as Ge,i as $e,s as je,e as l,k as p,w as it,t as m,M as Be,c as s,d as e,m as c,a as n,x as rt,h as f,b as r,N as Wt,G as a,g as o,y as ot,q as pt,o as ct,B as mt,v as Se}from"../../chunks/vendor-hf-doc-builder.js";import{T as Re}from"../../chunks/Tip-hf-doc-builder.js";import{I as Ce}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as te}from"../../chunks/CodeBlock-hf-doc-builder.js";function xe(ft){let u,_;return{c(){u=l("p"),_=m("\uC774\uC804\uC758 \uC2E4\uD5D8\uC801\uC778 \uC778\uD398\uC778\uD305 \uAD6C\uD604\uC5D0\uC11C\uB294 \uD488\uC9C8\uC774 \uB0AE\uC740 \uB2E4\uB978 \uD504\uB85C\uC138\uC2A4\uB97C \uC0AC\uC6A9\uD588\uC2B5\uB2C8\uB2E4. \uC774\uC804 \uBC84\uC804\uACFC\uC758 \uD638\uD658\uC131\uC744 \uBCF4\uC7A5\uD558\uAE30 \uC704\uD574 \uC0C8 \uBAA8\uB378\uC774 \uD3EC\uD568\uB418\uC9C0 \uC54A\uC740 \uC0AC\uC804\uD559\uC2B5\uB41C \uD30C\uC774\uD504\uB77C\uC778\uC744 \uBD88\uB7EC\uC624\uBA74 \uC774\uC804 \uC778\uD398\uC778\uD305 \uBC29\uBC95\uC774 \uACC4\uC18D \uC801\uC6A9\uB429\uB2C8\uB2E4.")},l(d){u=s(d,"P",{});var h=n(u);_=f(h,"\uC774\uC804\uC758 \uC2E4\uD5D8\uC801\uC778 \uC778\uD398\uC778\uD305 \uAD6C\uD604\uC5D0\uC11C\uB294 \uD488\uC9C8\uC774 \uB0AE\uC740 \uB2E4\uB978 \uD504\uB85C\uC138\uC2A4\uB97C \uC0AC\uC6A9\uD588\uC2B5\uB2C8\uB2E4. \uC774\uC804 \uBC84\uC804\uACFC\uC758 \uD638\uD658\uC131\uC744 \uBCF4\uC7A5\uD558\uAE30 \uC704\uD574 \uC0C8 \uBAA8\uB378\uC774 \uD3EC\uD568\uB418\uC9C0 \uC54A\uC740 \uC0AC\uC804\uD559\uC2B5\uB41C \uD30C\uC774\uD504\uB77C\uC778\uC744 \uBD88\uB7EC\uC624\uBA74 \uC774\uC804 \uC778\uD398\uC778\uD305 \uBC29\uBC95\uC774 \uACC4\uC18D \uC801\uC6A9\uB429\uB2C8\uB2E4."),h.forEach(e)},m(d,h){o(d,u,h),a(u,_)},d(d){d&&e(u)}}}function Ve(ft){let u,_,d,h,P,U,It,q,kt,ut,S,Gt,dt,g,z,$t,jt,Z,A,Bt,St,ht,M,Rt,K,Ct,xt,wt,W,yt,R,Vt,bt,I,gt,C,Xt,_t,k,Mt,J,O,w,x,L,Dt,Nt,V,tt,Ft,Qt,X,et,Yt,Ht,D,Pt,qt,at,y,N,G,ee,zt,F,$,ae,At,Q,lt,st,Kt,Ot,Y,j,le,Jt,T,Tt,H,Lt,vt,b,se,Et;return U=new Ce({}),W=new te({props:{code:"aW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uSW5wYWludFBpcGVsaW5lJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi1pbnBhaW50aW5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBKSUwQXBpcGVsaW5lJTIwJTNEJTIwcGlwZWxpbmUudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">import</span> PIL
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionInpaintPipeline

pipeline = StableDiffusionInpaintPipeline.from_pretrained(
    <span class="hljs-string">&quot;runwayml/stable-diffusion-inpainting&quot;</span>,
    torch_dtype=torch.float16,
)
pipeline = pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),I=new te({props:{code:"ZGVmJTIwZG93bmxvYWRfaW1hZ2UodXJsKSUzQSUwQSUyMCUyMCUyMCUyMHJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBQSUwuSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEElMEFpbWdfdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tJTJGQ29tcFZpcyUyRmxhdGVudC1kaWZmdXNpb24lMkZtYWluJTJGZGF0YSUyRmlucGFpbnRpbmdfZXhhbXBsZXMlMkZvdmVydHVyZS1jcmVhdGlvbnMtNXNJNmZRZ1lJdW8ucG5nJTIyJTBBbWFza191cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGbGF0ZW50LWRpZmZ1c2lvbiUyRm1haW4lMkZkYXRhJTJGaW5wYWludGluZ19leGFtcGxlcyUyRm92ZXJ0dXJlLWNyZWF0aW9ucy01c0k2ZlFnWUl1b19tYXNrLnBuZyUyMiUwQSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBkb3dubG9hZF9pbWFnZShpbWdfdXJsKS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTBBbWFza19pbWFnZSUyMCUzRCUyMGRvd25sb2FkX2ltYWdlKG1hc2tfdXJsKS5yZXNpemUoKDUxMiUyQyUyMDUxMikp",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url</span>):
    response = requests.get(url)
    <span class="hljs-keyword">return</span> PIL.Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)


img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>

init_image = download_image(img_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
mask_image = download_image(mask_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))`}}),k=new te({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyRmFjZSUyMG9mJTIwYSUyMHllbGxvdyUyMGNhdCUyQyUyMGhpZ2glMjByZXNvbHV0aW9uJTJDJTIwc2l0dGluZyUyMG9uJTIwYSUyMHBhcmslMjBiZW5jaCUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGluaXRfaW1hZ2UlMkMlMjBtYXNrX2ltYWdlJTNEbWFza19pbWFnZSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`prompt = <span class="hljs-string">&quot;Face of a yellow cat, high resolution, sitting on a park bench&quot;</span>
image = pipe(prompt=prompt, image=init_image, mask_image=mask_image).images[<span class="hljs-number">0</span>]`}}),T=new Re({props:{warning:!0,$$slots:{default:[xe]},$$scope:{ctx:ft}}}),{c(){u=l("meta"),_=p(),d=l("h1"),h=l("a"),P=l("span"),it(U.$$.fragment),It=p(),q=l("span"),kt=m("Text-guided \uC774\uBBF8\uC9C0 \uC778\uD398\uC778\uD305(inpainting)"),ut=p(),S=l("p"),Gt=m("[[\uCF54\uB7A9\uC5D0\uC11C \uC5F4\uAE30]]"),dt=p(),g=l("p"),z=l("code"),$t=m("StableDiffusionInpaintPipeline"),jt=m("\uC740 \uB9C8\uC2A4\uD06C\uC640 \uD14D\uC2A4\uD2B8 \uD504\uB86C\uD504\uD2B8\uB97C \uC81C\uACF5\uD558\uC5EC \uC774\uBBF8\uC9C0\uC758 \uD2B9\uC815 \uBD80\uBD84\uC744 \uD3B8\uC9D1\uD560 \uC218 \uC788\uB3C4\uB85D \uD569\uB2C8\uB2E4. \uC774 \uAE30\uB2A5\uC740 \uC778\uD398\uC778\uD305 \uC791\uC5C5\uC744 \uC704\uD574 \uD2B9\uBCC4\uD788 \uD6C8\uB828\uB41C "),Z=l("a"),A=l("code"),Bt=m("runwayml/stable-diffusion-inpainting"),St=m("\uACFC \uAC19\uC740 Stable Diffusion \uBC84\uC804\uC744 \uC0AC\uC6A9\uD569\uB2C8\uB2E4."),ht=p(),M=l("p"),Rt=m("\uBA3C\uC800 "),K=l("code"),Ct=m("StableDiffusionInpaintPipeline"),xt=m(" \uC778\uC2A4\uD134\uC2A4\uB97C \uBD88\uB7EC\uC635\uB2C8\uB2E4:"),wt=p(),it(W.$$.fragment),yt=p(),R=l("p"),Vt=m("\uB098\uC911\uC5D0 \uAD50\uCCB4\uD560 \uAC15\uC544\uC9C0 \uC774\uBBF8\uC9C0\uC640 \uB9C8\uC2A4\uD06C\uB97C \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694:"),bt=p(),it(I.$$.fragment),gt=p(),C=l("p"),Xt=m("\uC774\uC81C \uB9C8\uC2A4\uD06C\uB97C \uB2E4\uB978 \uAC83\uC73C\uB85C \uAD50\uCCB4\uD558\uB77C\uB294 \uD504\uB86C\uD504\uD2B8\uB97C \uB9CC\uB4E4 \uC218 \uC788\uC2B5\uB2C8\uB2E4:"),_t=p(),it(k.$$.fragment),Mt=p(),J=l("table"),O=l("thead"),w=l("tr"),x=l("th"),L=l("code"),Dt=m("image"),Nt=p(),V=l("th"),tt=l("code"),Ft=m("mask_image"),Qt=p(),X=l("th"),et=l("code"),Yt=m("prompt"),Ht=p(),D=l("th"),Pt=m("output"),qt=p(),at=l("tbody"),y=l("tr"),N=l("td"),G=l("img"),zt=p(),F=l("td"),$=l("img"),At=p(),Q=l("td"),lt=l("strong"),st=l("em"),Kt=m("Face of a yellow cat, high resolution, sitting on a park bench"),Ot=p(),Y=l("td"),j=l("img"),Jt=p(),it(T.$$.fragment),Tt=p(),H=l("p"),Lt=m("\uC544\uB798 Space\uC5D0\uC11C \uC774\uBBF8\uC9C0 \uC778\uD398\uC778\uD305\uC744 \uC9C1\uC811 \uD574\uBCF4\uC138\uC694!"),vt=p(),b=l("iframe"),this.h()},l(t){const i=Be('[data-svelte="svelte-1phssyn"]',document.head);u=s(i,"META",{name:!0,content:!0}),i.forEach(e),_=c(t),d=s(t,"H1",{class:!0});var B=n(d);h=s(B,"A",{id:!0,class:!0,href:!0});var ne=n(h);P=s(ne,"SPAN",{});var ie=n(P);rt(U.$$.fragment,ie),ie.forEach(e),ne.forEach(e),It=c(B),q=s(B,"SPAN",{});var re=n(q);kt=f(re,"Text-guided \uC774\uBBF8\uC9C0 \uC778\uD398\uC778\uD305(inpainting)"),re.forEach(e),B.forEach(e),ut=c(t),S=s(t,"P",{});var oe=n(S);Gt=f(oe,"[[\uCF54\uB7A9\uC5D0\uC11C \uC5F4\uAE30]]"),oe.forEach(e),dt=c(t),g=s(t,"P",{});var nt=n(g);z=s(nt,"CODE",{});var pe=n(z);$t=f(pe,"StableDiffusionInpaintPipeline"),pe.forEach(e),jt=f(nt,"\uC740 \uB9C8\uC2A4\uD06C\uC640 \uD14D\uC2A4\uD2B8 \uD504\uB86C\uD504\uD2B8\uB97C \uC81C\uACF5\uD558\uC5EC \uC774\uBBF8\uC9C0\uC758 \uD2B9\uC815 \uBD80\uBD84\uC744 \uD3B8\uC9D1\uD560 \uC218 \uC788\uB3C4\uB85D \uD569\uB2C8\uB2E4. \uC774 \uAE30\uB2A5\uC740 \uC778\uD398\uC778\uD305 \uC791\uC5C5\uC744 \uC704\uD574 \uD2B9\uBCC4\uD788 \uD6C8\uB828\uB41C "),Z=s(nt,"A",{href:!0,rel:!0});var ce=n(Z);A=s(ce,"CODE",{});var me=n(A);Bt=f(me,"runwayml/stable-diffusion-inpainting"),me.forEach(e),ce.forEach(e),St=f(nt,"\uACFC \uAC19\uC740 Stable Diffusion \uBC84\uC804\uC744 \uC0AC\uC6A9\uD569\uB2C8\uB2E4."),nt.forEach(e),ht=c(t),M=s(t,"P",{});var Ut=n(M);Rt=f(Ut,"\uBA3C\uC800 "),K=s(Ut,"CODE",{});var fe=n(K);Ct=f(fe,"StableDiffusionInpaintPipeline"),fe.forEach(e),xt=f(Ut," \uC778\uC2A4\uD134\uC2A4\uB97C \uBD88\uB7EC\uC635\uB2C8\uB2E4:"),Ut.forEach(e),wt=c(t),rt(W.$$.fragment,t),yt=c(t),R=s(t,"P",{});var ue=n(R);Vt=f(ue,"\uB098\uC911\uC5D0 \uAD50\uCCB4\uD560 \uAC15\uC544\uC9C0 \uC774\uBBF8\uC9C0\uC640 \uB9C8\uC2A4\uD06C\uB97C \uB2E4\uC6B4\uB85C\uB4DC\uD558\uC138\uC694:"),ue.forEach(e),bt=c(t),rt(I.$$.fragment,t),gt=c(t),C=s(t,"P",{});var de=n(C);Xt=f(de,"\uC774\uC81C \uB9C8\uC2A4\uD06C\uB97C \uB2E4\uB978 \uAC83\uC73C\uB85C \uAD50\uCCB4\uD558\uB77C\uB294 \uD504\uB86C\uD504\uD2B8\uB97C \uB9CC\uB4E4 \uC218 \uC788\uC2B5\uB2C8\uB2E4:"),de.forEach(e),_t=c(t),rt(k.$$.fragment,t),Mt=c(t),J=s(t,"TABLE",{});var Zt=n(J);O=s(Zt,"THEAD",{});var he=n(O);w=s(he,"TR",{});var v=n(w);x=s(v,"TH",{align:!0});var we=n(x);L=s(we,"CODE",{});var ye=n(L);Dt=f(ye,"image"),ye.forEach(e),we.forEach(e),Nt=c(v),V=s(v,"TH",{align:!0});var be=n(V);tt=s(be,"CODE",{});var ge=n(tt);Ft=f(ge,"mask_image"),ge.forEach(e),be.forEach(e),Qt=c(v),X=s(v,"TH",{align:!0});var _e=n(X);et=s(_e,"CODE",{});var Me=n(et);Yt=f(Me,"prompt"),Me.forEach(e),_e.forEach(e),Ht=c(v),D=s(v,"TH",{align:!0});var Je=n(D);Pt=f(Je,"output"),Je.forEach(e),v.forEach(e),he.forEach(e),qt=c(Zt),at=s(Zt,"TBODY",{});var Te=n(at);y=s(Te,"TR",{});var E=n(y);N=s(E,"TD",{align:!0});var ve=n(N);G=s(ve,"IMG",{src:!0,alt:!0,width:!0}),ve.forEach(e),zt=c(E),F=s(E,"TD",{align:!0});var Ee=n(F);$=s(Ee,"IMG",{src:!0,alt:!0,width:!0}),Ee.forEach(e),At=c(E),Q=s(E,"TD",{align:!0});var Ue=n(Q);lt=s(Ue,"STRONG",{});var Ze=n(lt);st=s(Ze,"EM",{});var We=n(st);Kt=f(We,"Face of a yellow cat, high resolution, sitting on a park bench"),We.forEach(e),Ze.forEach(e),Ue.forEach(e),Ot=c(E),Y=s(E,"TD",{align:!0});var Ie=n(Y);j=s(Ie,"IMG",{src:!0,alt:!0,width:!0}),Ie.forEach(e),E.forEach(e),Te.forEach(e),Zt.forEach(e),Jt=c(t),rt(T.$$.fragment,t),Tt=c(t),H=s(t,"P",{});var ke=n(H);Lt=f(ke,"\uC544\uB798 Space\uC5D0\uC11C \uC774\uBBF8\uC9C0 \uC778\uD398\uC778\uD305\uC744 \uC9C1\uC811 \uD574\uBCF4\uC138\uC694!"),ke.forEach(e),vt=c(t),b=s(t,"IFRAME",{src:!0,frameborder:!0,width:!0,height:!0}),n(b).forEach(e),this.h()},h(){r(u,"name","hf:doc:metadata"),r(u,"content",JSON.stringify(Xe)),r(h,"id","textguided-inpainting"),r(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),r(h,"href","#textguided-inpainting"),r(d,"class","relative group"),r(Z,"href","https://huggingface.co/runwayml/stable-diffusion-inpainting"),r(Z,"rel","nofollow"),r(x,"align","center"),r(V,"align","center"),r(X,"align","center"),r(D,"align","right"),Wt(G.src,ee="https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png")||r(G,"src",ee),r(G,"alt","drawing"),r(G,"width","250"),r(N,"align","center"),Wt($.src,ae="https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png")||r($,"src",ae),r($,"alt","drawing"),r($,"width","250"),r(F,"align","center"),r(Q,"align","center"),Wt(j.src,le="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/in_paint/yellow_cat_sitting_on_a_park_bench.png")||r(j,"src",le),r(j,"alt","drawing"),r(j,"width","250"),r(Y,"align","right"),Wt(b.src,se="https://runwayml-stable-diffusion-inpainting.hf.space")||r(b,"src",se),r(b,"frameborder","0"),r(b,"width","850"),r(b,"height","500")},m(t,i){a(document.head,u),o(t,_,i),o(t,d,i),a(d,h),a(h,P),ot(U,P,null),a(d,It),a(d,q),a(q,kt),o(t,ut,i),o(t,S,i),a(S,Gt),o(t,dt,i),o(t,g,i),a(g,z),a(z,$t),a(g,jt),a(g,Z),a(Z,A),a(A,Bt),a(g,St),o(t,ht,i),o(t,M,i),a(M,Rt),a(M,K),a(K,Ct),a(M,xt),o(t,wt,i),ot(W,t,i),o(t,yt,i),o(t,R,i),a(R,Vt),o(t,bt,i),ot(I,t,i),o(t,gt,i),o(t,C,i),a(C,Xt),o(t,_t,i),ot(k,t,i),o(t,Mt,i),o(t,J,i),a(J,O),a(O,w),a(w,x),a(x,L),a(L,Dt),a(w,Nt),a(w,V),a(V,tt),a(tt,Ft),a(w,Qt),a(w,X),a(X,et),a(et,Yt),a(w,Ht),a(w,D),a(D,Pt),a(J,qt),a(J,at),a(at,y),a(y,N),a(N,G),a(y,zt),a(y,F),a(F,$),a(y,At),a(y,Q),a(Q,lt),a(lt,st),a(st,Kt),a(y,Ot),a(y,Y),a(Y,j),o(t,Jt,i),ot(T,t,i),o(t,Tt,i),o(t,H,i),a(H,Lt),o(t,vt,i),o(t,b,i),Et=!0},p(t,[i]){const B={};i&2&&(B.$$scope={dirty:i,ctx:t}),T.$set(B)},i(t){Et||(pt(U.$$.fragment,t),pt(W.$$.fragment,t),pt(I.$$.fragment,t),pt(k.$$.fragment,t),pt(T.$$.fragment,t),Et=!0)},o(t){ct(U.$$.fragment,t),ct(W.$$.fragment,t),ct(I.$$.fragment,t),ct(k.$$.fragment,t),ct(T.$$.fragment,t),Et=!1},d(t){e(u),t&&e(_),t&&e(d),mt(U),t&&e(ut),t&&e(S),t&&e(dt),t&&e(g),t&&e(ht),t&&e(M),t&&e(wt),mt(W,t),t&&e(yt),t&&e(R),t&&e(bt),mt(I,t),t&&e(gt),t&&e(C),t&&e(_t),mt(k,t),t&&e(Mt),t&&e(J),t&&e(Jt),mt(T,t),t&&e(Tt),t&&e(H),t&&e(vt),t&&e(b)}}}const Xe={local:"textguided-inpainting",title:"Text-guided \uC774\uBBF8\uC9C0 \uC778\uD398\uC778\uD305(inpainting)"};function De(ft){return Se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class He extends Ge{constructor(u){super();$e(this,u,De,Ve,je,{})}}export{He as default,Xe as metadata};
