model-pulse / assets /Repos-IBLTT3va.js
tardellirs's picture
Update site
cad84dd verified
Raw History Blame Contribute Delete
13.5 kB
import{d as p,h as U,k as T,n as _,T as D,l as w,w as P,m as V,p as W,u as e,t as H,f as c,b as $,o as X,q as J,C as j,j as S,W as z,U as I,S as M,a as A,B,i as Q,r as ee,v as se,s as le,L as ae}from"./index-iljbJvME.js";const K={"3M":91,"6M":182,"1Y":365,All:null},O=i=>getComputedStyle(document.documentElement).getPropertyValue(i).trim(),ie=()=>e("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"#ff6b81","aria-hidden":"true",children:e("path",{d:"M12 21s-7.5-4.6-9.6-9.3C.9 8.2 3 4.5 6.6 4.5c2.1 0 3.6 1.1 5.4 3 1.8-1.9 3.3-3 5.4-3 3.6 0 5.7 3.7 4.2 7.2C19.5 16.4 12 21 12 21z"})});function N(i,s,d){return D(()=>{if(d)return d;const r=K[s];if(!r||!i.length||!i[0].t.length)return null;const h=i[0].t[i[0].t.length-1];return[h-r*86400,h]},[i,s,d])}function Z({value:i,onChange:s}){return e("div",{class:"seg",role:"group","aria-label":"Time range",children:Object.keys(K).map(d=>e("button",{"aria-pressed":i===d,onClick:()=>s(d),children:d},d))})}function Y({route:i,text:s}){const d=le(i);return e("section",{class:"section",children:e("div",{class:"wrap w-actions g-actions",children:[e("a",{class:"btn",target:"_blank",rel:"noopener",href:`https://x.com/intent/post?text=${encodeURIComponent(s)}&url=${encodeURIComponent(d)}`,children:"Post on X"}),e("a",{class:"btn",target:"_blank",rel:"noopener",href:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(d)}`,children:"LinkedIn"}),e("button",{class:"btn",onClick:()=>{var r;return(r=navigator.clipboard)==null?void 0:r.writeText(d)},children:"Copy link"}),e(ae,{})]})})}function G({id:i,space:s}){return e("div",{class:"wrap hero",children:[e("div",{class:"crumbs",style:{visibility:"hidden"},children:e("span",{class:"chip",children:"loading"})}),e("h1",{class:`model-name${s?" sp-title":""}`,children:s?i.split("/").pop():i}),s&&e("p",{class:"sp-id",children:i}),e("div",{class:"skeleton",style:{marginTop:24}})]})}function q({id:i,err:s}){return e("div",{class:"wrap err",children:[e("h1",{children:["No history for ",i]}),e("p",{class:"muted",children:s})]})}function te({id:i}){const[s,d]=i.includes("/")?[i.split("/")[0],i.split("/").slice(1).join("/")]:[null,i];return e("h1",{class:"model-name",children:[s&&e("a",{href:A({author:s}),onClick:r=>{r.preventDefault(),_({author:s})},class:"org",children:[s,"/"]}),s&&e("wbr",{}),e("span",{class:"hl",children:d})]})}function ne({id:i}){const[s,d]=p("month"),r=`${B}/badge/dataset/${i}.svg${s==="month"?"":`?metric=${s}`}`,h=`[![Model Pulse](${r})](${ee}?dataset=${i})`;return e("section",{class:"section",children:e("div",{class:"wrap",children:e("div",{class:"card ds-badge",children:[e("h3",{children:"Badge for your dataset card"}),e("p",{children:["Updates daily. Paste it into the README of ",i.split("/").pop(),"."]}),e("div",{class:"seg badge-opts",role:"group","aria-label":"Badge metric",children:[e("button",{"aria-pressed":s==="month",onClick:()=>d("month"),children:"Monthly"}),e("button",{"aria-pressed":s==="all",onClick:()=>d("all"),children:"All time"}),e("button",{"aria-pressed":s==="likes",onClick:()=>d("likes"),children:"Likes"})]}),e("div",{class:"badge-preview",children:e("img",{src:r.replace(B,Q),alt:"Model Pulse badge preview",height:22})}),e("div",{class:"code",children:[e("code",{children:h}),e(se,{text:h,label:"Copy markdown"})]})]})})})}function ce({id:i}){const[s,d]=p(null),[r,h]=p(null),[o,C]=p("weekly"),[b,L]=p("1Y"),[x,u]=p(null),g=n=>{u(null),C(n)};U(()=>{d(null),h(null),T.dataset(i).then(n=>{d(n),n.dataset.id!==i&&_({dataset:n.dataset.id},!0),document.title=`${n.dataset.id} downloads: daily history and stats · Model Pulse`}).catch(n=>h(n.message))},[i]);const k=!!s&&s.series.dl_all.filter(n=>n!=null).length>7,l=(o==="weekly"||o==="daily")&&!k?"month":o,v=D(()=>{if(!s)return[];const n=s.series,R=O("--c1");if(l==="weekly"){const f=w(n.day,n.dl_all),F=P(f.t,f.v);return[{label:s.dataset.id,color:R,t:F.t,v:F.v,fill:!0}]}if(l==="daily"){const f=w(n.day,n.dl_all);return[{label:s.dataset.id,color:R,t:f.t,v:V(f.v,7),fill:!0}]}const E=W(n.day,l==="month"?n.dl30:l==="total"?n.dl_all:n.likes);return[{label:s.dataset.id,color:R,t:E.t,v:E.v,fill:!0}]},[s,l]),t=D(()=>s&&l==="weekly"?P(w(s.series.day,s.series.dl_all).t,w(s.series.day,s.series.dl_all).v).partial:!1,[s,l]),m=N(v,b,x);if(r)return e(q,{id:i,err:r});if(!s)return e(G,{id:i});const a=s.dataset,y=a.id.split("/").pop();return e(M,{children:[e("div",{class:"wrap hero",children:[e("div",{class:"crumbs",children:[e("span",{class:"chip chip-kind",children:"Dataset"}),a.pipeline_tag&&e("span",{class:"chip",children:H(a.pipeline_tag)}),a.size&&e("span",{class:"chip",children:[a.size," rows"]}),a.license&&e("span",{class:"chip",children:a.license}),a.likes!=null&&e("span",{class:"chip",children:[e(ie,{}),c(a.likes)," likes",a.likes_7d?e("span",{class:"up",children:["+",c(a.likes_7d)]}):null]}),e("a",{class:"chip",href:`https://huggingface.co/datasets/${a.id}`,target:"_blank",rel:"noopener",children:"Open on Hugging Face ↗"})]}),e(te,{id:a.id}),e("div",{class:"card stats",style:{padding:0},children:[e("div",{class:"fig fig-main",children:[e("div",{class:"num",children:c(a.dl_all??a.dl30)}),e("div",{class:"label",children:a.dl_all!=null?"downloads all time":"downloads in the last 30 days"})]}),e("div",{class:"fig",children:[e("div",{class:"val",children:$(a.dl30)}),e("div",{class:"label",children:"last 30 days"})]}),e("div",{class:"fig",children:[e("div",{class:"val",children:[$(a.dl_7d),a.growth_7d!=null&&e("small",{class:a.growth_7d>=0?"up":"down",children:X(a.growth_7d)})]}),e("div",{class:"label",children:["last 7 days",a.growth_7d!=null?", vs. 3-week average":""]})]}),e("div",{class:"fig",children:[e("div",{class:"val",children:["#",c(a.rank_dl30)]}),e("div",{class:"label",children:["among datasets",a.rank_task&&a.pipeline_tag?`, ${J(a.rank_task)} in ${H(a.pipeline_tag)}`:""]})]})]}),e("div",{class:"card chart-card",children:[e("div",{class:"chart-bar",children:e("div",{class:"left",children:[e("div",{class:"seg",role:"group","aria-label":"Metric",children:[k&&e("button",{"aria-pressed":l==="weekly",onClick:()=>g("weekly"),children:"Weekly"}),k&&e("button",{"aria-pressed":l==="daily",onClick:()=>g("daily"),children:"Daily"}),e("button",{"aria-pressed":l==="month",onClick:()=>g("month"),children:"Rolling 30 days"}),k&&e("button",{"aria-pressed":l==="total",onClick:()=>g("total"),children:"All time"}),e("button",{"aria-pressed":l==="likes",onClick:()=>g("likes"),children:"Likes"})]}),e(Z,{value:b,onChange:n=>{u(null),L(n)}})]})}),e(j,{lines:v,range:m,onZoom:u,height:360,bars:l==="weekly",partialLast:l==="weekly"&&!!t,endLabel:l!=="weekly",tipDate:l==="weekly"?n=>`Week of ${S(new Date((n-z/2)*1e3),{month:"short",day:"numeric",year:"numeric"})}`:void 0,valueLabel:l==="daily"?n=>c(n)+"/day":l==="weekly"?n=>c(n)+"/week":void 0}),e("p",{class:"chart-note",children:[l==="weekly"&&"Downloads per week, Monday to Sunday; the striped bar is the week in progress. ",l==="daily"&&"7-day average of daily downloads. ","Dataset downloads follow the Hub's counting rules. Drag on the chart to zoom, double-click to reset."]})]})]}),(s.models.count>0||s.spaces.count>0)&&e("section",{class:"section",children:e("div",{class:"wrap",children:[e("div",{class:"section-head",children:e("div",{children:[e("h2",{children:["Who uses ",y]}),e("p",{children:["Models whose card lists ",y," as training data, and Spaces whose card lists it."]})]})}),e("div",{class:"ub-grid",children:[e(I,{title:"Models trained on it",data:s.models,by:"model",note:"Counted from today's model cards, by the month each model was created."}),e(I,{title:"Spaces using it",data:s.spaces,by:"space",note:"Counted from today's Space cards, by the month each Space was created."})]})]})}),e("section",{class:"section",children:e("div",{class:"wrap about",children:[e("h2",{children:["About ",y]}),e("p",{children:[e("b",{children:a.id})," is a",/^[aeio]/i.test(a.pipeline_tag??"")?"n":""," ",a.pipeline_tag?`${H(a.pipeline_tag)} `:"","dataset on the Hugging Face Hub."," ","In the last 30 days it was downloaded ",e("b",{children:c(a.dl30)})," times",a.dl_all?e(M,{children:[", and ",e("b",{children:c(a.dl_all)})," times in total"]}):null,".",a.rank_dl30?` It ranks #${c(a.rank_dl30)} among datasets by monthly downloads.`:"",a.used_by_models?` ${c(a.used_by_models)} models list it as training data`:"",a.used_by_models&&a.used_by_spaces?`, and ${c(a.used_by_spaces)} Spaces use it.`:a.used_by_models?".":a.used_by_spaces?` ${c(a.used_by_spaces)} Spaces use it.`:""]}),a.description&&e("p",{class:"muted",children:[a.description,a.description.length>=300?"…":""]})]})}),e(ne,{id:a.id}),e(Y,{route:{dataset:a.id},text:`${a.id} has ${$(a.dl_all??a.dl30)} downloads on Hugging Face. Full download history:`})]})}function re({id:i}){const[s,d]=p(null),[r,h]=p(null),[o,C]=p("weekly"),[b,L]=p("1Y"),[x,u]=p(null);U(()=>{d(null),h(null),T.space(i).then(t=>{d(t),t.space.id!==i&&_({space:t.space.id},!0),document.title=`${t.space.title||t.space.id}: likes over time · Model Pulse`}).catch(t=>h(t.message))},[i]);const g=D(()=>{if(!s)return[];const t=O("--c3");if(o==="total"){const y=W(s.series.day,s.series.likes);return[{label:s.space.id,color:t,t:y.t,v:y.v,fill:!0}]}const m=w(s.series.day,s.series.likes),a=P(m.t,m.v);return[{label:s.space.id,color:t,t:a.t,v:a.v,fill:!0}]},[s,o]),k=N(g,b,x);if(r)return e(q,{id:i,err:r});if(!s)return e(G,{id:i,space:!0});const l=s.space,v=[...s.uses.models.map(t=>({...t,kind:"model"})),...s.uses.datasets.map(t=>({...t,kind:"dataset"}))];return e(M,{children:[e("div",{class:"wrap hero",children:[e("div",{class:"crumbs",children:[e("span",{class:"chip chip-kind",children:"Space"}),l.sdk&&e("span",{class:"chip",children:l.sdk}),l.created_at&&e("span",{class:"chip",children:["since ",S(l.created_at,{month:"short",year:"numeric"})]}),e("a",{class:"chip",href:`https://huggingface.co/spaces/${l.id}`,target:"_blank",rel:"noopener",children:"Open on Hugging Face ↗"})]}),e("h1",{class:"model-name sp-title",children:[l.emoji&&e("span",{class:"emo","aria-hidden":"true",children:l.emoji}),e("span",{class:"hl",children:l.title||l.id.split("/").pop()})]}),e("p",{class:"sp-id",children:[e("a",{href:A({author:l.id.split("/")[0]}),onClick:t=>{t.preventDefault(),_({author:l.id.split("/")[0]})},children:l.id.split("/")[0]}),"/",l.id.split("/").slice(1).join("/"),l.short_description?e(M,{children:[" · ",l.short_description]}):null]}),e("div",{class:"card stats",style:{padding:0},children:[e("div",{class:"fig fig-main",children:[e("div",{class:"num",children:c(l.likes)}),e("div",{class:"label",children:"likes"})]}),e("div",{class:"fig",children:[e("div",{class:"val",children:["+",c(l.likes_7d)]}),e("div",{class:"label",children:"last 7 days"})]}),e("div",{class:"fig",children:[e("div",{class:"val",children:["+",c(l.likes_30d)]}),e("div",{class:"label",children:"last 30 days"})]}),e("div",{class:"fig",children:[e("div",{class:"val",children:["#",c(l.rank_likes)]}),e("div",{class:"label",children:"among Spaces by likes"})]})]}),e("div",{class:"card chart-card",children:[e("div",{class:"chart-bar",children:e("div",{class:"left",children:[e("div",{class:"seg",role:"group","aria-label":"Metric",children:[e("button",{"aria-pressed":o==="weekly",onClick:()=>{u(null),C("weekly")},children:"Likes per week"}),e("button",{"aria-pressed":o==="total",onClick:()=>{u(null),C("total")},children:"Total likes"})]}),e(Z,{value:b,onChange:t=>{u(null),L(t)}})]})}),e(j,{lines:g,range:k,onZoom:u,height:340,bars:o==="weekly",endLabel:o!=="weekly",tipDate:o==="weekly"?t=>`Week of ${S(new Date((t-z/2)*1e3),{month:"short",day:"numeric",year:"numeric"})}`:void 0,valueLabel:o==="weekly"?t=>`+${c(t)} likes`:t=>`${c(t)} likes`}),e("p",{class:"chart-note",children:"The Hub doesn't publish visits or usage for Spaces, so likes are the measure here. Drag on the chart to zoom, double-click to reset."})]})]}),v.length>0&&e("section",{class:"section",children:e("div",{class:"wrap",children:[e("div",{class:"section-head",children:e("div",{children:[e("h2",{children:"What it uses"}),e("p",{children:"Models and datasets listed in this Space's card, by downloads in the last 30 days."})]})}),e("div",{class:"card",children:e("ol",{class:"ub-list",children:v.map(t=>{const m=t.kind==="model"?{model:t.id}:{dataset:t.id};return e("li",{children:e("a",{href:A(m),onClick:a=>{a.preventDefault(),_(m)},children:[e("span",{class:`kind k-${t.kind}`,children:t.kind}),e("span",{class:"nm",children:t.id}),e("span",{class:"v",children:t.dl30!=null?`${$(t.dl30)}/mo`:"not tracked"})]})},`${t.kind}:${t.id}`)})})})]})}),e("section",{class:"section",children:e("div",{class:"wrap about",children:[e("h2",{children:["About ",l.title||l.id]}),e("p",{children:[e("b",{children:l.id})," is a",l.sdk&&/^[aeio]/i.test(l.sdk)?"n":""," ",l.sdk?`${l.sdk} `:"","Space on the Hugging Face Hub",l.created_at?`, created in ${S(l.created_at,{month:"long",year:"numeric"})}`:"","."," ","It has ",e("b",{children:c(l.likes)})," likes, ",c(l.likes_7d)," of them in the last 7 days and ",c(l.likes_30d)," in the last 30, and ranks #",c(l.rank_likes)," among Spaces by likes.",v.length?` Its card lists ${c(s.uses.models.length)} model${s.uses.models.length===1?"":"s"} and ${c(s.uses.datasets.length)} dataset${s.uses.datasets.length===1?"":"s"}.`:""]})]})}),e(Y,{route:{space:l.id},text:`${l.title||l.id} has ${$(l.likes)} likes on Hugging Face. Likes over time:`})]})}export{ce as DatasetPage,re as SpacePage};