Buckets:
| import{S as Kt,i as Qt,s as Wt,e as i,k as f,w as d,t as u,M as Xt,c as s,d as t,m as p,a,x as h,h as m,b as o,G as r,g as n,y as g,L as Yt,q as _,o as c,B as v,v as Zt}from"../../chunks/vendor-hf-doc-builder.js";import{D as re}from"../../chunks/Docstring-hf-doc-builder.js";import{I as ee}from"../../chunks/IconCopyLink-hf-doc-builder.js";function er($t){let $,be,y,S,ie,z,Ke,se,Qe,we,te,We,Ee,b,D,ae,M,Xe,oe,Ye,xe,w,T,Ze,le,et,Pe,E,U,ne,O,tt,fe,rt,Ie,x,B,it,pe,st,ke,P,C,ue,G,at,me,ot,Le,I,J,lt,R,nt,de,ft,pt,Ae,k,H,he,j,ut,ge,mt,Ne,F,K,Se,L,V,_e,Q,dt,ce,ht,De,W,X,Ue,A,q,ve,Y,gt,$e,_t,Ce,N,Z,ct,ye,vt,He;return z=new ee({}),M=new ee({}),T=new re({props:{name:"diffusers.utils.numpy_to_pil",anchor:"diffusers.utils.numpy_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/pil_utils.py#L37"}}),O=new ee({}),B=new re({props:{name:"diffusers.utils.pt_to_pil",anchor:"diffusers.utils.pt_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/pil_utils.py#L27"}}),G=new ee({}),J=new re({props:{name:"diffusers.utils.load_image",anchor:"diffusers.utils.load_image",parameters:[{name:"image",val:": typing.Union[str, PIL.Image.Image]"}],parametersDescription:[{anchor:"diffusers.utils.load_image.image",description:`<strong>image</strong> (<code>str</code> or <code>PIL.Image.Image</code>) — | |
| The image to convert to the PIL Image format.`,name:"image"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/loading_utils.py#L9",returnDescription:` | |
| <p>A PIL Image.</p> | |
| `,returnType:` | |
| <p><code>PIL.Image.Image</code></p> | |
| `}}),j=new ee({}),K=new re({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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/export_utils.py#L31"}}),Q=new ee({}),X=new re({props:{name:"diffusers.utils.export_to_video",anchor:"diffusers.utils.export_to_video",parameters:[{name:"video_frames",val:": typing.List[numpy.ndarray]"},{name:"output_video_path",val:": str = None"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/export_utils.py#L118"}}),Y=new ee({}),Z=new re({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/main/src/diffusers/utils/pil_utils.py#L53"}}),{c(){$=i("meta"),be=f(),y=i("h1"),S=i("a"),ie=i("span"),d(z.$$.fragment),Ke=f(),se=i("span"),Qe=u("Utilities"),we=f(),te=i("p"),We=u("Utility and helper functions for working with \u{1F917} Diffusers."),Ee=f(),b=i("h2"),D=i("a"),ae=i("span"),d(M.$$.fragment),Xe=f(),oe=i("span"),Ye=u("numpy_to_pil"),xe=f(),w=i("div"),d(T.$$.fragment),Ze=f(),le=i("p"),et=u("Convert a numpy image or a batch of images to a PIL image."),Pe=f(),E=i("h2"),U=i("a"),ne=i("span"),d(O.$$.fragment),tt=f(),fe=i("span"),rt=u("pt_to_pil"),Ie=f(),x=i("div"),d(B.$$.fragment),it=f(),pe=i("p"),st=u("Convert a torch image to a PIL image."),ke=f(),P=i("h2"),C=i("a"),ue=i("span"),d(G.$$.fragment),at=f(),me=i("span"),ot=u("load_image"),Le=f(),I=i("div"),d(J.$$.fragment),lt=f(),R=i("p"),nt=u("Loads "),de=i("code"),ft=u("image"),pt=u(" to a PIL Image."),Ae=f(),k=i("h2"),H=i("a"),he=i("span"),d(j.$$.fragment),ut=f(),ge=i("span"),mt=u("export_to_gif"),Ne=f(),F=i("div"),d(K.$$.fragment),Se=f(),L=i("h2"),V=i("a"),_e=i("span"),d(Q.$$.fragment),dt=f(),ce=i("span"),ht=u("export_to_video"),De=f(),W=i("div"),d(X.$$.fragment),Ue=f(),A=i("h2"),q=i("a"),ve=i("span"),d(Y.$$.fragment),gt=f(),$e=i("span"),_t=u("make_image_grid"),Ce=f(),N=i("div"),d(Z.$$.fragment),ct=f(),ye=i("p"),vt=u("Prepares a single grid of images. Useful for visualization purposes."),this.h()},l(e){const l=Xt('[data-svelte="svelte-1phssyn"]',document.head);$=s(l,"META",{name:!0,content:!0}),l.forEach(t),be=p(e),y=s(e,"H1",{class:!0});var Ve=a(y);S=s(Ve,"A",{id:!0,class:!0,href:!0});var yt=a(S);ie=s(yt,"SPAN",{});var bt=a(ie);h(z.$$.fragment,bt),bt.forEach(t),yt.forEach(t),Ke=p(Ve),se=s(Ve,"SPAN",{});var wt=a(se);Qe=m(wt,"Utilities"),wt.forEach(t),Ve.forEach(t),we=p(e),te=s(e,"P",{});var Et=a(te);We=m(Et,"Utility and helper functions for working with \u{1F917} Diffusers."),Et.forEach(t),Ee=p(e),b=s(e,"H2",{class:!0});var qe=a(b);D=s(qe,"A",{id:!0,class:!0,href:!0});var xt=a(D);ae=s(xt,"SPAN",{});var Pt=a(ae);h(M.$$.fragment,Pt),Pt.forEach(t),xt.forEach(t),Xe=p(qe),oe=s(qe,"SPAN",{});var It=a(oe);Ye=m(It,"numpy_to_pil"),It.forEach(t),qe.forEach(t),xe=p(e),w=s(e,"DIV",{class:!0});var ze=a(w);h(T.$$.fragment,ze),Ze=p(ze),le=s(ze,"P",{});var kt=a(le);et=m(kt,"Convert a numpy image or a batch of images to a PIL image."),kt.forEach(t),ze.forEach(t),Pe=p(e),E=s(e,"H2",{class:!0});var Me=a(E);U=s(Me,"A",{id:!0,class:!0,href:!0});var Lt=a(U);ne=s(Lt,"SPAN",{});var At=a(ne);h(O.$$.fragment,At),At.forEach(t),Lt.forEach(t),tt=p(Me),fe=s(Me,"SPAN",{});var Nt=a(fe);rt=m(Nt,"pt_to_pil"),Nt.forEach(t),Me.forEach(t),Ie=p(e),x=s(e,"DIV",{class:!0});var Te=a(x);h(B.$$.fragment,Te),it=p(Te),pe=s(Te,"P",{});var St=a(pe);st=m(St,"Convert a torch image to a PIL image."),St.forEach(t),Te.forEach(t),ke=p(e),P=s(e,"H2",{class:!0});var Oe=a(P);C=s(Oe,"A",{id:!0,class:!0,href:!0});var Dt=a(C);ue=s(Dt,"SPAN",{});var Ut=a(ue);h(G.$$.fragment,Ut),Ut.forEach(t),Dt.forEach(t),at=p(Oe),me=s(Oe,"SPAN",{});var Ct=a(me);ot=m(Ct,"load_image"),Ct.forEach(t),Oe.forEach(t),Le=p(e),I=s(e,"DIV",{class:!0});var Be=a(I);h(J.$$.fragment,Be),lt=p(Be),R=s(Be,"P",{});var Ge=a(R);nt=m(Ge,"Loads "),de=s(Ge,"CODE",{});var Ht=a(de);ft=m(Ht,"image"),Ht.forEach(t),pt=m(Ge," to a PIL Image."),Ge.forEach(t),Be.forEach(t),Ae=p(e),k=s(e,"H2",{class:!0});var Je=a(k);H=s(Je,"A",{id:!0,class:!0,href:!0});var Vt=a(H);he=s(Vt,"SPAN",{});var qt=a(he);h(j.$$.fragment,qt),qt.forEach(t),Vt.forEach(t),ut=p(Je),ge=s(Je,"SPAN",{});var zt=a(ge);mt=m(zt,"export_to_gif"),zt.forEach(t),Je.forEach(t),Ne=p(e),F=s(e,"DIV",{class:!0});var Mt=a(F);h(K.$$.fragment,Mt),Mt.forEach(t),Se=p(e),L=s(e,"H2",{class:!0});var Re=a(L);V=s(Re,"A",{id:!0,class:!0,href:!0});var Tt=a(V);_e=s(Tt,"SPAN",{});var Ot=a(_e);h(Q.$$.fragment,Ot),Ot.forEach(t),Tt.forEach(t),dt=p(Re),ce=s(Re,"SPAN",{});var Bt=a(ce);ht=m(Bt,"export_to_video"),Bt.forEach(t),Re.forEach(t),De=p(e),W=s(e,"DIV",{class:!0});var Gt=a(W);h(X.$$.fragment,Gt),Gt.forEach(t),Ue=p(e),A=s(e,"H2",{class:!0});var je=a(A);q=s(je,"A",{id:!0,class:!0,href:!0});var Jt=a(q);ve=s(Jt,"SPAN",{});var Rt=a(ve);h(Y.$$.fragment,Rt),Rt.forEach(t),Jt.forEach(t),gt=p(je),$e=s(je,"SPAN",{});var jt=a($e);_t=m(jt,"make_image_grid"),jt.forEach(t),je.forEach(t),Ce=p(e),N=s(e,"DIV",{class:!0});var Fe=a(N);h(Z.$$.fragment,Fe),ct=p(Fe),ye=s(Fe,"P",{});var Ft=a(ye);vt=m(Ft,"Prepares a single grid of images. Useful for visualization purposes."),Ft.forEach(t),Fe.forEach(t),this.h()},h(){o($,"name","hf:doc:metadata"),o($,"content",JSON.stringify(tr)),o(S,"id","utilities"),o(S,"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"),o(S,"href","#utilities"),o(y,"class","relative group"),o(D,"id","diffusers.utils.numpy_to_pil"),o(D,"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"),o(D,"href","#diffusers.utils.numpy_to_pil"),o(b,"class","relative group"),o(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(U,"id","diffusers.utils.pt_to_pil"),o(U,"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"),o(U,"href","#diffusers.utils.pt_to_pil"),o(E,"class","relative group"),o(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(C,"id","diffusers.utils.load_image"),o(C,"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"),o(C,"href","#diffusers.utils.load_image"),o(P,"class","relative group"),o(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(H,"id","diffusers.utils.export_to_gif"),o(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"),o(H,"href","#diffusers.utils.export_to_gif"),o(k,"class","relative group"),o(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(V,"id","diffusers.utils.export_to_video"),o(V,"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"),o(V,"href","#diffusers.utils.export_to_video"),o(L,"class","relative group"),o(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(q,"id","diffusers.utils.make_image_grid"),o(q,"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"),o(q,"href","#diffusers.utils.make_image_grid"),o(A,"class","relative group"),o(N,"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,l){r(document.head,$),n(e,be,l),n(e,y,l),r(y,S),r(S,ie),g(z,ie,null),r(y,Ke),r(y,se),r(se,Qe),n(e,we,l),n(e,te,l),r(te,We),n(e,Ee,l),n(e,b,l),r(b,D),r(D,ae),g(M,ae,null),r(b,Xe),r(b,oe),r(oe,Ye),n(e,xe,l),n(e,w,l),g(T,w,null),r(w,Ze),r(w,le),r(le,et),n(e,Pe,l),n(e,E,l),r(E,U),r(U,ne),g(O,ne,null),r(E,tt),r(E,fe),r(fe,rt),n(e,Ie,l),n(e,x,l),g(B,x,null),r(x,it),r(x,pe),r(pe,st),n(e,ke,l),n(e,P,l),r(P,C),r(C,ue),g(G,ue,null),r(P,at),r(P,me),r(me,ot),n(e,Le,l),n(e,I,l),g(J,I,null),r(I,lt),r(I,R),r(R,nt),r(R,de),r(de,ft),r(R,pt),n(e,Ae,l),n(e,k,l),r(k,H),r(H,he),g(j,he,null),r(k,ut),r(k,ge),r(ge,mt),n(e,Ne,l),n(e,F,l),g(K,F,null),n(e,Se,l),n(e,L,l),r(L,V),r(V,_e),g(Q,_e,null),r(L,dt),r(L,ce),r(ce,ht),n(e,De,l),n(e,W,l),g(X,W,null),n(e,Ue,l),n(e,A,l),r(A,q),r(q,ve),g(Y,ve,null),r(A,gt),r(A,$e),r($e,_t),n(e,Ce,l),n(e,N,l),g(Z,N,null),r(N,ct),r(N,ye),r(ye,vt),He=!0},p:Yt,i(e){He||(_(z.$$.fragment,e),_(M.$$.fragment,e),_(T.$$.fragment,e),_(O.$$.fragment,e),_(B.$$.fragment,e),_(G.$$.fragment,e),_(J.$$.fragment,e),_(j.$$.fragment,e),_(K.$$.fragment,e),_(Q.$$.fragment,e),_(X.$$.fragment,e),_(Y.$$.fragment,e),_(Z.$$.fragment,e),He=!0)},o(e){c(z.$$.fragment,e),c(M.$$.fragment,e),c(T.$$.fragment,e),c(O.$$.fragment,e),c(B.$$.fragment,e),c(G.$$.fragment,e),c(J.$$.fragment,e),c(j.$$.fragment,e),c(K.$$.fragment,e),c(Q.$$.fragment,e),c(X.$$.fragment,e),c(Y.$$.fragment,e),c(Z.$$.fragment,e),He=!1},d(e){t($),e&&t(be),e&&t(y),v(z),e&&t(we),e&&t(te),e&&t(Ee),e&&t(b),v(M),e&&t(xe),e&&t(w),v(T),e&&t(Pe),e&&t(E),v(O),e&&t(Ie),e&&t(x),v(B),e&&t(ke),e&&t(P),v(G),e&&t(Le),e&&t(I),v(J),e&&t(Ae),e&&t(k),v(j),e&&t(Ne),e&&t(F),v(K),e&&t(Se),e&&t(L),v(Q),e&&t(De),e&&t(W),v(X),e&&t(Ue),e&&t(A),v(Y),e&&t(Ce),e&&t(N),v(Z)}}}const tr={local:"utilities",sections:[{local:"diffusers.utils.numpy_to_pil",title:"numpy_to_pil"},{local:"diffusers.utils.pt_to_pil",title:"pt_to_pil"},{local:"diffusers.utils.load_image",title:"load_image"},{local:"diffusers.utils.export_to_gif",title:"export_to_gif"},{local:"diffusers.utils.export_to_video",title:"export_to_video"},{local:"diffusers.utils.make_image_grid",title:"make_image_grid"}],title:"Utilities"};function rr($t){return Zt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class or extends Kt{constructor($){super();Qt(this,$,rr,er,Wt,{})}}export{or as default,tr as metadata}; | |
Xet Storage Details
- Size:
- 12.1 kB
- Xet hash:
- 5d2764e9ca22dd80f8cc2da74c79eac0ca2093cf25b19f56a4149c61460ad13c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.