import{s as Me,n as Ae,o as Fe}from"../chunks/scheduler.8c3d61f6.js";import{S as Oe,i as ze,g as n,s,r as o,A as Ge,h as l,f as i,c as a,j as y,u as m,x as K,k as x,y as u,a as r,v as f,d,t as p,w as g}from"../chunks/index.da70eac4.js";import{D as S}from"../chunks/Docstring.6b390b9a.js";import{H as I,E as Se}from"../chunks/EditOnGithub.1e64e623.js";function je(Te){let _,Y,Q,Z,L,ee,w,De="Utility and helper functions for working with 🤗 Diffusers.",te,P,ie,$,C,Ie,j,Ee="Convert a numpy image or a batch of images to a PIL image.",re,T,se,c,D,Le,W,Ue="Convert a torch image to a PIL image.",ae,E,ne,h,U,we,q,Ne="Loads <code>image</code> to a PIL Image.",oe,N,le,k,R,me,V,fe,H,M,de,A,pe,v,F,Pe,B,ke="Prepares a single grid of images. Useful for visualization purposes.",ge,O,ue,b,z,Ce,J,Re=`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 L=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 S({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_10012/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 S({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_10012/src/diffusers/utils/pil_utils.py#L27"}}),E=new I({props:{title:"load_image",local:"diffusers.utils.load_image",headingTag:"h2"}}),U=new S({props:{name:"diffusers.utils.load_image",anchor:"diffusers.utils.load_image",parameters:[{name:"image",val:": typing.Union[str, PIL.Image.Image]"},{name:"convert_method",val:": typing.Optional[typing.Callable[[PIL.Image.Image], PIL.Image.Image]] = 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], <em>optional</em>) &#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_10012/src/diffusers/utils/loading_utils.py#L13",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>
`}}),N=new I({props:{title:"export_to_gif",local:"diffusers.utils.export_to_gif",headingTag:"h2"}}),R=new S({props:{name:"diffusers.utils.export_to_gif",anchor:"diffusers.utils.export_to_gif",parameters:[{name:"image",val:": typing.List[PIL.Image.Image]"},{name:"output_gif_path",val:": str = None"},{name:"fps",val:": int = 10"}],source:"https://github.com/huggingface/diffusers/blob/vr_10012/src/diffusers/utils/export_utils.py#L28"}}),V=new I({props:{title:"export_to_video",local:"diffusers.utils.export_to_video",headingTag:"h2"}}),M=new S({props:{name:"diffusers.utils.export_to_video",anchor:"diffusers.utils.export_to_video",parameters:[{name:"video_frames",val:": typing.Union[typing.List[numpy.ndarray], typing.List[PIL.Image.Image]]"},{name:"output_video_path",val:": str = None"},{name:"fps",val:": int = 10"}],source:"https://github.com/huggingface/diffusers/blob/vr_10012/src/diffusers/utils/export_utils.py#L141"}}),A=new I({props:{title:"make_image_grid",local:"diffusers.utils.make_image_grid",headingTag:"h2"}}),F=new S({props:{name:"diffusers.utils.make_image_grid",anchor:"diffusers.utils.make_image_grid",parameters:[{name:"images",val:": typing.List[PIL.Image.Image]"},{name:"rows",val:": int"},{name:"cols",val:": int"},{name:"resize",val:": int = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_10012/src/diffusers/utils/pil_utils.py#L53"}}),O=new I({props:{title:"randn_tensor",local:"diffusers.utils.torch_utils.randn_tensor",headingTag:"h2"}}),z=new S({props:{name:"diffusers.utils.torch_utils.randn_tensor",anchor:"diffusers.utils.torch_utils.randn_tensor",parameters:[{name:"shape",val:": typing.Union[typing.Tuple, typing.List]"},{name:"generator",val:": typing.Union[typing.List[ForwardRef('torch.Generator')], ForwardRef('torch.Generator'), NoneType] = None"},{name:"device",val:": typing.Optional[ForwardRef('torch.device')] = None"},{name:"dtype",val:": typing.Optional[ForwardRef('torch.dtype')] = None"},{name:"layout",val:": typing.Optional[ForwardRef('torch.layout')] = None"}],source:"https://github.com/huggingface/diffusers/blob/vr_10012/src/diffusers/utils/torch_utils.py#L38"}}),G=new Se({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/utilities.md"}}),{c(){_=n("meta"),Y=s(),Q=n("p"),Z=s(),o(L.$$.fragment),ee=s(),w=n("p"),w.textContent=De,te=s(),o(P.$$.fragment),ie=s(),$=n("div"),o(C.$$.fragment),Ie=s(),j=n("p"),j.textContent=Ee,re=s(),o(T.$$.fragment),se=s(),c=n("div"),o(D.$$.fragment),Le=s(),W=n("p"),W.textContent=Ue,ae=s(),o(E.$$.fragment),ne=s(),h=n("div"),o(U.$$.fragment),we=s(),q=n("p"),q.innerHTML=Ne,oe=s(),o(N.$$.fragment),le=s(),k=n("div"),o(R.$$.fragment),me=s(),o(V.$$.fragment),fe=s(),H=n("div"),o(M.$$.fragment),de=s(),o(A.$$.fragment),pe=s(),v=n("div"),o(F.$$.fragment),Pe=s(),B=n("p"),B.textContent=ke,ge=s(),o(O.$$.fragment),ue=s(),b=n("div"),o(z.$$.fragment),Ce=s(),J=n("p"),J.innerHTML=Re,_e=s(),o(G.$$.fragment),$e=s(),X=n("p"),this.h()},l(e){const t=Ge("svelte-u9bgzb",document.head);_=l(t,"META",{name:!0,content:!0}),t.forEach(i),Y=a(e),Q=l(e,"P",{}),y(Q).forEach(i),Z=a(e),m(L.$$.fragment,e),ee=a(e),w=l(e,"P",{"data-svelte-h":!0}),K(w)!=="svelte-sj662i"&&(w.textContent=De),te=a(e),m(P.$$.fragment,e),ie=a(e),$=l(e,"DIV",{class:!0});var he=y($);m(C.$$.fragment,he),Ie=a(he),j=l(he,"P",{"data-svelte-h":!0}),K(j)!=="svelte-49eriv"&&(j.textContent=Ee),he.forEach(i),re=a(e),m(T.$$.fragment,e),se=a(e),c=l(e,"DIV",{class:!0});var ve=y(c);m(D.$$.fragment,ve),Le=a(ve),W=l(ve,"P",{"data-svelte-h":!0}),K(W)!=="svelte-haxfgr"&&(W.textContent=Ue),ve.forEach(i),ae=a(e),m(E.$$.fragment,e),ne=a(e),h=l(e,"DIV",{class:!0});var be=y(h);m(U.$$.fragment,be),we=a(be),q=l(be,"P",{"data-svelte-h":!0}),K(q)!=="svelte-suegrh"&&(q.innerHTML=Ne),be.forEach(i),oe=a(e),m(N.$$.fragment,e),le=a(e),k=l(e,"DIV",{class:!0});var Ve=y(k);m(R.$$.fragment,Ve),Ve.forEach(i),me=a(e),m(V.$$.fragment,e),fe=a(e),H=l(e,"DIV",{class:!0});var He=y(H);m(M.$$.fragment,He),He.forEach(i),de=a(e),m(A.$$.fragment,e),pe=a(e),v=l(e,"DIV",{class:!0});var ye=y(v);m(F.$$.fragment,ye),Pe=a(ye),B=l(ye,"P",{"data-svelte-h":!0}),K(B)!=="svelte-rk2372"&&(B.textContent=ke),ye.forEach(i),ge=a(e),m(O.$$.fragment,e),ue=a(e),b=l(e,"DIV",{class:!0});var xe=y(b);m(z.$$.fragment,xe),Ce=a(xe),J=l(xe,"P",{"data-svelte-h":!0}),K(J)!=="svelte-11ct46x"&&(J.innerHTML=Re),xe.forEach(i),_e=a(e),m(G.$$.fragment,e),$e=a(e),X=l(e,"P",{}),y(X).forEach(i),this.h()},h(){x(_,"name","hf:doc:metadata"),x(_,"content",We),x($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(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){u(document.head,_),r(e,Y,t),r(e,Q,t),r(e,Z,t),f(L,e,t),r(e,ee,t),r(e,w,t),r(e,te,t),f(P,e,t),r(e,ie,t),r(e,$,t),f(C,$,null),u($,Ie),u($,j),r(e,re,t),f(T,e,t),r(e,se,t),r(e,c,t),f(D,c,null),u(c,Le),u(c,W),r(e,ae,t),f(E,e,t),r(e,ne,t),r(e,h,t),f(U,h,null),u(h,we),u(h,q),r(e,oe,t),f(N,e,t),r(e,le,t),r(e,k,t),f(R,k,null),r(e,me,t),f(V,e,t),r(e,fe,t),r(e,H,t),f(M,H,null),r(e,de,t),f(A,e,t),r(e,pe,t),r(e,v,t),f(F,v,null),u(v,Pe),u(v,B),r(e,ge,t),f(O,e,t),r(e,ue,t),r(e,b,t),f(z,b,null),u(b,Ce),u(b,J),r(e,_e,t),f(G,e,t),r(e,$e,t),r(e,X,t),ce=!0},p:Ae,i(e){ce||(d(L.$$.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(N.$$.fragment,e),d(R.$$.fragment,e),d(V.$$.fragment,e),d(M.$$.fragment,e),d(A.$$.fragment,e),d(F.$$.fragment,e),d(O.$$.fragment,e),d(z.$$.fragment,e),d(G.$$.fragment,e),ce=!0)},o(e){p(L.$$.fragment,e),p(P.$$.fragment,e),p(C.$$.fragment,e),p(T.$$.fragment,e),p(D.$$.fragment,e),p(E.$$.fragment,e),p(U.$$.fragment,e),p(N.$$.fragment,e),p(R.$$.fragment,e),p(V.$$.fragment,e),p(M.$$.fragment,e),p(A.$$.fragment,e),p(F.$$.fragment,e),p(O.$$.fragment,e),p(z.$$.fragment,e),p(G.$$.fragment,e),ce=!1},d(e){e&&(i(Y),i(Q),i(Z),i(ee),i(w),i(te),i(ie),i($),i(re),i(se),i(c),i(ae),i(ne),i(h),i(oe),i(le),i(k),i(me),i(fe),i(H),i(de),i(pe),i(v),i(ge),i(ue),i(b),i(_e),i($e),i(X)),i(_),g(L,e),g(P,e),g(C),g(T,e),g(D),g(E,e),g(U),g(N,e),g(R),g(V,e),g(M),g(A,e),g(F),g(O,e),g(z),g(G,e)}}}const We='{"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 qe(Te){return Fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xe extends Oe{constructor(_){super(),ze(this,_,qe,je,Me,{})}}export{Xe as component};
