import{s as Ae,n as ze,o as Oe}from"../chunks/scheduler.8c3d61f6.js";import{S as Se,i as je,g as a,s as r,r as l,A as Ge,h as o,f as i,c as n,j as x,u as m,x as K,k as y,y as g,a as s,v as f,d,t as u,w as p}from"../chunks/index.589a98e8.js";import{D as R}from"../chunks/Docstring.27406313.js";import{H as I,E as Re}from"../chunks/EditOnGithub.e5a8d9cb.js";function We(Te){let _,Y,Q,Z,w,ee,L,De="Utility and helper functions for working with 🤗 Diffusers.",te,P,ie,$,C,Ie,W,Ee="Convert a numpy image or a batch of images to a PIL image.",se,T,re,c,D,we,q,Ue="Convert a torch image to a PIL image.",ne,E,ae,v,U,Le,B,ke="Loads <code>image</code> to a PIL Image.",le,k,oe,N,V,me,H,fe,M,A,de,z,ue,h,O,Pe,F,Ne="Prepares a single grid of images. Useful for visualization purposes.",pe,S,ge,b,j,Ce,J,Ve=`A helper function to create random tensors on the desired <code>device</code> with the desired <code>dtype</code>. When
passing a list of generators, you can seed each batch size individually. If CPU generators are passed, the tensor
is always created on the CPU.`,_e,G,$e,X,ce;return w=new I({props:{title:"Utilities",local:"utilities",headingTag:"h1"}}),P=new I({props:{title:"numpy_to_pil",local:"diffusers.utils.numpy_to_pil",headingTag:"h2"}}),C=new R({props:{name:"diffusers.utils.numpy_to_pil",anchor:"diffusers.utils.numpy_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/pil_utils.py#L37"}}),T=new I({props:{title:"pt_to_pil",local:"diffusers.utils.pt_to_pil",headingTag:"h2"}}),D=new R({props:{name:"diffusers.utils.pt_to_pil",anchor:"diffusers.utils.pt_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/pil_utils.py#L27"}}),E=new I({props:{title:"load_image",local:"diffusers.utils.load_image",headingTag:"h2"}}),U=new R({props:{name:"diffusers.utils.load_image",anchor:"diffusers.utils.load_image",parameters:[{name:"image",val:": Union"},{name:"convert_method",val:": Callable = None"}],parametersDescription:[{anchor:"diffusers.utils.load_image.image",description:`<strong>image</strong> (<code>str</code> or <code>PIL.Image.Image</code>) &#x2014;
The image to convert to the PIL Image format.`,name:"image"},{anchor:"diffusers.utils.load_image.convert_method",description:`<strong>convert_method</strong> (Callable[[PIL.Image.Image], PIL.Image.Image], optional) &#x2014;
A conversion method to apply to the image after loading it. When set to <code>None</code> the image will be converted
&#x201C;RGB&#x201D;.`,name:"convert_method"}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/loading_utils.py#L9",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A PIL Image.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>PIL.Image.Image</code></p>
`}}),k=new I({props:{title:"export_to_gif",local:"diffusers.utils.export_to_gif",headingTag:"h2"}}),V=new R({props:{name:"diffusers.utils.export_to_gif",anchor:"diffusers.utils.export_to_gif",parameters:[{name:"image",val:": List"},{name:"output_gif_path",val:": str = None"},{name:"fps",val:": int = 10"}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/export_utils.py#L31"}}),H=new I({props:{title:"export_to_video",local:"diffusers.utils.export_to_video",headingTag:"h2"}}),A=new R({props:{name:"diffusers.utils.export_to_video",anchor:"diffusers.utils.export_to_video",parameters:[{name:"video_frames",val:": Union"},{name:"output_video_path",val:": str = None"},{name:"fps",val:": int = 10"}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/export_utils.py#L118"}}),z=new I({props:{title:"make_image_grid",local:"diffusers.utils.make_image_grid",headingTag:"h2"}}),O=new R({props:{name:"diffusers.utils.make_image_grid",anchor:"diffusers.utils.make_image_grid",parameters:[{name:"images",val:": List"},{name:"rows",val:": int"},{name:"cols",val:": int"},{name:"resize",val:": int = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/pil_utils.py#L53"}}),S=new I({props:{title:"randn_tensor",local:"diffusers.utils.torch_utils.randn_tensor",headingTag:"h2"}}),j=new R({props:{name:"diffusers.utils.torch_utils.randn_tensor",anchor:"diffusers.utils.torch_utils.randn_tensor",parameters:[{name:"shape",val:": Union"},{name:"generator",val:": Union = None"},{name:"device",val:": Optional = None"},{name:"dtype",val:": Optional = None"},{name:"layout",val:": Optional = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_8492/src/diffusers/utils/torch_utils.py#L38"}}),G=new Re({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/utilities.md"}}),{c(){_=a("meta"),Y=r(),Q=a("p"),Z=r(),l(w.$$.fragment),ee=r(),L=a("p"),L.textContent=De,te=r(),l(P.$$.fragment),ie=r(),$=a("div"),l(C.$$.fragment),Ie=r(),W=a("p"),W.textContent=Ee,se=r(),l(T.$$.fragment),re=r(),c=a("div"),l(D.$$.fragment),we=r(),q=a("p"),q.textContent=Ue,ne=r(),l(E.$$.fragment),ae=r(),v=a("div"),l(U.$$.fragment),Le=r(),B=a("p"),B.innerHTML=ke,le=r(),l(k.$$.fragment),oe=r(),N=a("div"),l(V.$$.fragment),me=r(),l(H.$$.fragment),fe=r(),M=a("div"),l(A.$$.fragment),de=r(),l(z.$$.fragment),ue=r(),h=a("div"),l(O.$$.fragment),Pe=r(),F=a("p"),F.textContent=Ne,pe=r(),l(S.$$.fragment),ge=r(),b=a("div"),l(j.$$.fragment),Ce=r(),J=a("p"),J.innerHTML=Ve,_e=r(),l(G.$$.fragment),$e=r(),X=a("p"),this.h()},l(e){const t=Ge("svelte-u9bgzb",document.head);_=o(t,"META",{name:!0,content:!0}),t.forEach(i),Y=n(e),Q=o(e,"P",{}),x(Q).forEach(i),Z=n(e),m(w.$$.fragment,e),ee=n(e),L=o(e,"P",{"data-svelte-h":!0}),K(L)!=="svelte-sj662i"&&(L.textContent=De),te=n(e),m(P.$$.fragment,e),ie=n(e),$=o(e,"DIV",{class:!0});var ve=x($);m(C.$$.fragment,ve),Ie=n(ve),W=o(ve,"P",{"data-svelte-h":!0}),K(W)!=="svelte-49eriv"&&(W.textContent=Ee),ve.forEach(i),se=n(e),m(T.$$.fragment,e),re=n(e),c=o(e,"DIV",{class:!0});var he=x(c);m(D.$$.fragment,he),we=n(he),q=o(he,"P",{"data-svelte-h":!0}),K(q)!=="svelte-haxfgr"&&(q.textContent=Ue),he.forEach(i),ne=n(e),m(E.$$.fragment,e),ae=n(e),v=o(e,"DIV",{class:!0});var be=x(v);m(U.$$.fragment,be),Le=n(be),B=o(be,"P",{"data-svelte-h":!0}),K(B)!=="svelte-suegrh"&&(B.innerHTML=ke),be.forEach(i),le=n(e),m(k.$$.fragment,e),oe=n(e),N=o(e,"DIV",{class:!0});var He=x(N);m(V.$$.fragment,He),He.forEach(i),me=n(e),m(H.$$.fragment,e),fe=n(e),M=o(e,"DIV",{class:!0});var Me=x(M);m(A.$$.fragment,Me),Me.forEach(i),de=n(e),m(z.$$.fragment,e),ue=n(e),h=o(e,"DIV",{class:!0});var xe=x(h);m(O.$$.fragment,xe),Pe=n(xe),F=o(xe,"P",{"data-svelte-h":!0}),K(F)!=="svelte-rk2372"&&(F.textContent=Ne),xe.forEach(i),pe=n(e),m(S.$$.fragment,e),ge=n(e),b=o(e,"DIV",{class:!0});var ye=x(b);m(j.$$.fragment,ye),Ce=n(ye),J=o(ye,"P",{"data-svelte-h":!0}),K(J)!=="svelte-11ct46x"&&(J.innerHTML=Ve),ye.forEach(i),_e=n(e),m(G.$$.fragment,e),$e=n(e),X=o(e,"P",{}),x(X).forEach(i),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",qe),y($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){g(document.head,_),s(e,Y,t),s(e,Q,t),s(e,Z,t),f(w,e,t),s(e,ee,t),s(e,L,t),s(e,te,t),f(P,e,t),s(e,ie,t),s(e,$,t),f(C,$,null),g($,Ie),g($,W),s(e,se,t),f(T,e,t),s(e,re,t),s(e,c,t),f(D,c,null),g(c,we),g(c,q),s(e,ne,t),f(E,e,t),s(e,ae,t),s(e,v,t),f(U,v,null),g(v,Le),g(v,B),s(e,le,t),f(k,e,t),s(e,oe,t),s(e,N,t),f(V,N,null),s(e,me,t),f(H,e,t),s(e,fe,t),s(e,M,t),f(A,M,null),s(e,de,t),f(z,e,t),s(e,ue,t),s(e,h,t),f(O,h,null),g(h,Pe),g(h,F),s(e,pe,t),f(S,e,t),s(e,ge,t),s(e,b,t),f(j,b,null),g(b,Ce),g(b,J),s(e,_e,t),f(G,e,t),s(e,$e,t),s(e,X,t),ce=!0},p:ze,i(e){ce||(d(w.$$.fragment,e),d(P.$$.fragment,e),d(C.$$.fragment,e),d(T.$$.fragment,e),d(D.$$.fragment,e),d(E.$$.fragment,e),d(U.$$.fragment,e),d(k.$$.fragment,e),d(V.$$.fragment,e),d(H.$$.fragment,e),d(A.$$.fragment,e),d(z.$$.fragment,e),d(O.$$.fragment,e),d(S.$$.fragment,e),d(j.$$.fragment,e),d(G.$$.fragment,e),ce=!0)},o(e){u(w.$$.fragment,e),u(P.$$.fragment,e),u(C.$$.fragment,e),u(T.$$.fragment,e),u(D.$$.fragment,e),u(E.$$.fragment,e),u(U.$$.fragment,e),u(k.$$.fragment,e),u(V.$$.fragment,e),u(H.$$.fragment,e),u(A.$$.fragment,e),u(z.$$.fragment,e),u(O.$$.fragment,e),u(S.$$.fragment,e),u(j.$$.fragment,e),u(G.$$.fragment,e),ce=!1},d(e){e&&(i(Y),i(Q),i(Z),i(ee),i(L),i(te),i(ie),i($),i(se),i(re),i(c),i(ne),i(ae),i(v),i(le),i(oe),i(N),i(me),i(fe),i(M),i(de),i(ue),i(h),i(pe),i(ge),i(b),i(_e),i($e),i(X)),i(_),p(w,e),p(P,e),p(C),p(T,e),p(D),p(E,e),p(U),p(k,e),p(V),p(H,e),p(A),p(z,e),p(O),p(S,e),p(j),p(G,e)}}}const qe='{"title":"Utilities","local":"utilities","sections":[{"title":"numpy_to_pil","local":"diffusers.utils.numpy_to_pil","sections":[],"depth":2},{"title":"pt_to_pil","local":"diffusers.utils.pt_to_pil","sections":[],"depth":2},{"title":"load_image","local":"diffusers.utils.load_image","sections":[],"depth":2},{"title":"export_to_gif","local":"diffusers.utils.export_to_gif","sections":[],"depth":2},{"title":"export_to_video","local":"diffusers.utils.export_to_video","sections":[],"depth":2},{"title":"make_image_grid","local":"diffusers.utils.make_image_grid","sections":[],"depth":2},{"title":"randn_tensor","local":"diffusers.utils.torch_utils.randn_tensor","sections":[],"depth":2}],"depth":1}';function Be(Te){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xe extends Se{constructor(_){super(),je(this,_,Be,We,Ae,{})}}export{Xe as component};
