import{S as Mi,i as vi,s as bi,e as s,k as c,w as f,t as n,N as ji,c as o,d as t,m as d,a as r,x as w,h as i,b as p,P as Ks,G as a,g as h,y as m,q as y,o as M,B as v,v as ki}from"../chunks/vendor-hf-doc-builder.js";import{T as Ir}from"../chunks/Tip-hf-doc-builder.js";import{I as U}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as R}from"../chunks/CodeBlock-hf-doc-builder.js";function gi(Q){let u,b;return{c(){u=s("p"),b=n("Webhooks are now publicly available!")},l(j){u=o(j,"P",{});var T=r(u);b=i(T,"Webhooks are now publicly available!"),T.forEach(t)},m(j,T){h(j,u,T),a(u,b)},d(j){j&&t(u)}}}function Ji(Q){let u;return{c(){u=n("`:=` is the Python Syntax for an assignment expression operator added to the Python language in version 3.8 (colloquially known as the walrus operator). People have mixed opinions on this syntax, and it doesn't change how Python evaluates the code if you don't use this. You can read more about this operator in this [Real Python article](https://realpython.com/python-walrus-operator/).")},l(b){u=i(b,"`:=` is the Python Syntax for an assignment expression operator added to the Python language in version 3.8 (colloquially known as the walrus operator). People have mixed opinions on this syntax, and it doesn't change how Python evaluates the code if you don't use this. You can read more about this operator in this [Real Python article](https://realpython.com/python-walrus-operator/).")},m(b,j){h(b,u,j)},d(b){b&&t(u)}}}function Ei(Q){let u;return{c(){u=n('When creating a bot that will interact with other users on the Hub, we ask that you clearly label the account as a "Bot" (see profile screenshot).')},l(b){u=i(b,'When creating a bot that will interact with other users on the Hub, we ask that you clearly label the account as a "Bot" (see profile screenshot).')},m(b,j){h(b,u,j)},d(b){b&&t(u)}}}function Ti(Q){let u,b,j,T,Ct,Me,eo,Wt,to,Ta,L,_a,ot,ao,Aa,N,D,Bt,ve,so,St,oo,$a,lt,lo,Ia,J,be,ro,no,je,io,ho,Zt,po,co,ke,uo,fo,Rt,wo,mo,Ua,ge,Ca,z,yo,Nt,Mo,vo,Wa,O,bo,Je,jo,ko,Ba,rt,nt,Ur,Sa,K,go,Ee,Jo,Eo,Za,X,ee,Xt,Te,To,Gt,_o,Ra,g,Ao,Yt,$o,Io,_e,Uo,Co,Pt,Wo,Bo,xt,So,Zo,Ht,Ro,No,Na,Ae,Xa,it,Xo,Ga,$e,Ya,G,te,Vt,Ie,Go,Ft,Yo,Pa,ae,Po,qt,xo,Ho,xa,se,Vo,Qt,Fo,qo,Ha,Ue,Va,C,Qo,Lt,Lo,Do,Dt,zo,Oo,Fa,Ce,qa,oe,Ko,We,el,tl,Qa,ht,al,La,Be,Da,pt,sl,za,Se,Oa,ct,ol,Ka,Ze,es,Y,le,zt,Re,ll,Ot,rl,ts,re,nl,Kt,il,hl,as,Ne,ss,ne,os,P,ie,ea,Xe,pl,ta,cl,ls,dt,dl,rs,x,he,aa,Ge,ul,sa,fl,ns,pe,wl,Ye,ml,yl,is,W,oa,Ml,vl,Pe,bl,xe,jl,kl,gl,He,Jl,la,El,Tl,hs,ut,_l,ps,ft,wt,Cr,cs,H,ce,ra,Ve,Al,na,$l,ds,mt,Il,us,yt,Mt,Wr,fs,de,ws,V,ue,ia,Fe,Ul,ha,Cl,ms,A,Wl,qe,Bl,Sl,Qe,Zl,Rl,Le,Nl,Xl,ys,k,De,Gl,Yl,pa,Pl,xl,ca,Hl,Vl,da,Fl,ql,ua,Ql,Ll,vt,Dl,zl,Ms,ze,vs,bt,Ol,bs,F,fe,fa,Oe,Kl,wa,er,js,B,tr,Ke,ar,sr,jt,or,lr,ks,E,rr,et,nr,ir,ma,hr,pr,ya,cr,dr,kt,ur,fr,gs,gt,wr,Js,Jt,Et,Br,Es,we,mr,Ma,yr,Mr,Ts,q,me,va,tt,vr,ba,br,_s,Tt,jr,As,S,ja,kr,gr,at,Jr,ka,Er,Tr,_r,ga,Ar,$s,_t,$r,Is;return Me=new U({}),L=new Ir({props:{$$slots:{default:[gi]},$$scope:{ctx:Q}}}),ve=new U({}),ge=new R({props:{code:"LS0tJTBBbGFuZ3VhZ2UlM0ElMjAlMEElMjAlMjAtJTIwJTIyTGlzdCUyMG9mJTIwSVNPJTIwNjM5LTElMjBjb2RlJTIwZm9yJTIweW91ciUyMGxhbmd1YWdlJTIyJTBBJTIwJTIwLSUyMGxhbmcxJTBBJTIwJTIwLSUyMGxhbmcyJTBBdGFncyUzQSUwQS0lMjB0YWcxJTBBLSUyMHRhZzIlMEFsaWNlbnNlJTNBJTIwJTIyYW55JTIwdmFsaWQlMjBsaWNlbnNlJTIwaWRlbnRpZmllciUyMiUwQWRhdGFzZXRzJTNBJTBBLSUyMGRhdGFzZXQxJTBBLS0t",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">language:</span> 
  <span class="hljs-bullet">-</span> <span class="hljs-string">&quot;List of ISO 639-1 code for your language&quot;</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">lang1</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">lang2</span>
<span class="hljs-attr">tags:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">tag1</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">tag2</span>
<span class="hljs-attr">license:</span> <span class="hljs-string">&quot;any valid license identifier&quot;</span>
<span class="hljs-attr">datasets:</span>
<span class="hljs-bullet">-</span> <span class="hljs-string">dataset1</span>
<span class="hljs-meta">---</span>`}}),Te=new U({}),Ae=new R({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMERhdGFzZXRDYXJkJTJDJTIwTW9kZWxDYXJkJTBBZnJvbSUyMGh1Z2dpbmdmYWNlX2h1Yi51dGlscyUyMGltcG9ydCUyMEVudHJ5Tm90Rm91bmRFcnJvciUyMCUwQSUwQWRlZiUyMGxvYWRfcmVwb19jYXJkX21ldGFkYXRhKHJlcG9fdHlwZSUyQyUyMHJlcG9fbmFtZSklM0ElMEElMjAlMjAlMjAlMjBpZiUyMHJlcG9fdHlwZSUyMCUzRCUzRCUyMCUyMmRhdGFzZXQlMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cnklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBEYXRhc2V0Q2FyZC5sb2FkKHJlcG9fbmFtZSkuZGF0YS50b19kaWN0KCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBleGNlcHQlMjBFbnRyeU5vdEZvdW5kRXJyb3IlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlN0IlN0QlMEElMjAlMjAlMjAlMjBpZiUyMHJlcG9fdHlwZSUyMCUzRCUzRCUyMCUyMm1vZGVsJTIyJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdHJ5JTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwTW9kZWxDYXJkLmxvYWQocmVwb19uYW1lKS5kYXRhLnRvX2RpY3QoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGV4Y2VwdCUyMEVudHJ5Tm90Rm91bmRFcnJvciUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCU3QiU3RA==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> DatasetCard, ModelCard
<span class="hljs-keyword">from</span> huggingface_hub.utils <span class="hljs-keyword">import</span> EntryNotFoundError 

<span class="hljs-keyword">def</span> <span class="hljs-title function_">load_repo_card_metadata</span>(<span class="hljs-params">repo_type, repo_name</span>):
    <span class="hljs-keyword">if</span> repo_type == <span class="hljs-string">&quot;dataset&quot;</span>:
        <span class="hljs-keyword">try</span>:
            <span class="hljs-keyword">return</span> DatasetCard.load(repo_name).data.to_dict()
        <span class="hljs-keyword">except</span> EntryNotFoundError:
            <span class="hljs-keyword">return</span> {}
    <span class="hljs-keyword">if</span> repo_type == <span class="hljs-string">&quot;model&quot;</span>:
        <span class="hljs-keyword">try</span>:
            <span class="hljs-keyword">return</span> ModelCard.load(repo_name).data.to_dict()
        <span class="hljs-keyword">except</span> EntryNotFoundError:
            <span class="hljs-keyword">return</span> {}`}}),$e=new R({props:{code:"JTdCJ2xpY2Vuc2UnJTNBJTIwJ2FmbC0zLjAnJTdE",highlighted:'{<span class="hljs-string">&#x27;license&#x27;</span>: <span class="hljs-string">&#x27;afl-3.0&#x27;</span>}'}}),Ie=new U({}),Ue=new R({props:{code:"ZGVmJTIwY3JlYXRlX21ldGFkYXRhX2tleV9kaWN0KGNhcmRfZGF0YSUyQyUyMHJlcG9fdHlwZSUzQSUyMHN0ciklM0ElMEElMjAlMjAlMjAlMjBzaGFyZWRfa2V5cyUyMCUzRCUyMCU1QiUyMnRhZ3MlMjIlMkMlMjAlMjJsaWNlbnNlJTIyJTVEJTBBJTIwJTIwJTIwJTIwaWYlMjByZXBvX3R5cGUlMjAlM0QlM0QlMjAlMjJtb2RlbCUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1vZGVsX2tleXMlMjAlM0QlMjAlNUIlMjJsaWJyYXJ5X25hbWUlMjIlMkMlMjAlMjJkYXRhc2V0cyUyMiUyQyUyMCUyMm1ldHJpY3MlMjIlMkMlMjAlMjJjbzIlMjIlMkMlMjAlMjJwaXBlbGluZV90YWclMjIlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBzaGFyZWRfa2V5cy5leHRlbmQobW9kZWxfa2V5cyklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBrZXlzJTIwJTNEJTIwc2hhcmVkX2tleXMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlN0JrZXklM0ElMjBjYXJkX2RhdGEuZ2V0KGtleSklMjBmb3IlMjBrZXklMjBpbiUyMGtleXMlN0QlMEElMjAlMjAlMjAlMjBpZiUyMHJlcG9fdHlwZSUyMCUzRCUzRCUyMCUyMmRhdGFzZXQlMjIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjAlNUIuLi4lNUQ=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">create_metadata_key_dict</span>(<span class="hljs-params">card_data, repo_type: <span class="hljs-built_in">str</span></span>):
    shared_keys = [<span class="hljs-string">&quot;tags&quot;</span>, <span class="hljs-string">&quot;license&quot;</span>]
    <span class="hljs-keyword">if</span> repo_type == <span class="hljs-string">&quot;model&quot;</span>:
        model_keys = [<span class="hljs-string">&quot;library_name&quot;</span>, <span class="hljs-string">&quot;datasets&quot;</span>, <span class="hljs-string">&quot;metrics&quot;</span>, <span class="hljs-string">&quot;co2&quot;</span>, <span class="hljs-string">&quot;pipeline_tag&quot;</span>]
        shared_keys.extend(model_keys)
        keys = shared_keys
        <span class="hljs-keyword">return</span> {key: card_data.get(key) <span class="hljs-keyword">for</span> key <span class="hljs-keyword">in</span> keys}
    <span class="hljs-keyword">if</span> repo_type == <span class="hljs-string">&quot;dataset&quot;</span>:
        <span class="hljs-comment"># [...]</span>`}}),Ce=new R({props:{code:"JTdCJ3RhZ3MnJTNBJTIwTm9uZSUyQyUwQSUyMCdsaWNlbnNlJyUzQSUyMCdhZmwtMy4wJyUyQyUwQSUyMCdsaWJyYXJ5X25hbWUnJTNBJTIwTm9uZSUyQyUwQSUyMCdkYXRhc2V0cyclM0ElMjBOb25lJTJDJTBBJTIwJ21ldHJpY3MnJTNBJTIwTm9uZSUyQyUwQSUyMCdjbzInJTNBJTIwTm9uZSUyQyUwQSUyMCdwaXBlbGluZV90YWcnJTNBJTIwTm9uZSU3RA==",highlighted:`{<span class="hljs-string">&#x27;tags&#x27;</span>: <span class="hljs-literal">None</span>,
 <span class="hljs-string">&#x27;license&#x27;</span>: <span class="hljs-string">&#x27;afl-3.0&#x27;</span>,
 <span class="hljs-string">&#x27;library_name&#x27;</span>: <span class="hljs-literal">None</span>,
 <span class="hljs-string">&#x27;datasets&#x27;</span>: <span class="hljs-literal">None</span>,
 <span class="hljs-string">&#x27;metrics&#x27;</span>: <span class="hljs-literal">None</span>,
 <span class="hljs-string">&#x27;co2&#x27;</span>: <span class="hljs-literal">None</span>,
 <span class="hljs-string">&#x27;pipeline_tag&#x27;</span>: <span class="hljs-literal">None</span>}`}}),Be=new R({props:{code:"ZGVmJTIwY3JlYXRlX21ldGFkYXRhX2JyZWFrZG93bl90YWJsZShkZXNpcmVkX21ldGFkYXRhX2RpY3Rpb25hcnkpJTNBJTBBJTIwJTIwJTIwJTIwJTIzJTIwJTVCLi4uJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwdGFidWxhdGUoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdGFibGVfZGF0YSUyQyUyMHRhYmxlZm10JTNEJTIyZ2l0aHViJTIyJTJDJTIwaGVhZGVycyUzRCglMjJNZXRhZGF0YSUyMEZpZWxkJTIyJTJDJTIwJTIyUHJvdmlkZWQlMjBWYWx1ZSUyMiklMEElMjAlMjAlMjAlMjAp",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">create_metadata_breakdown_table</span>(<span class="hljs-params">desired_metadata_dictionary</span>):
    <span class="hljs-comment"># [...]</span>
    <span class="hljs-keyword">return</span> tabulate(
        table_data, tablefmt=<span class="hljs-string">&quot;github&quot;</span>, headers=(<span class="hljs-string">&quot;Metadata Field&quot;</span>, <span class="hljs-string">&quot;Provided Value&quot;</span>)
    )`}}),Se=new R({props:{code:"ZGVmJTIwY2FsY3VsYXRlX2dyYWRlKGRlc2lyZWRfbWV0YWRhdGFfZGljdGlvbmFyeSklM0ElMEElMjAlMjAlMjAlMjAlMjMlMjAlNUIuLi4lNUQlMEElMjAlMjAlMjAlMjByZXR1cm4lMjByb3VuZChzY29yZSUyQyUyMDIp",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">calculate_grade</span>(<span class="hljs-params">desired_metadata_dictionary</span>):
    <span class="hljs-comment"># [...]</span>
    <span class="hljs-keyword">return</span> <span class="hljs-built_in">round</span>(score, <span class="hljs-number">2</span>)`}}),Ze=new R({props:{code:"ZGVmJTIwY3JlYXRlX21hcmtkb3duX3JlcG9ydCglMEElMjAlMjAlMjAlMjBkZXNpcmVkX21ldGFkYXRhX2RpY3Rpb25hcnklMkMlMjByZXBvX25hbWUlMkMlMjByZXBvX3R5cGUlMkMlMjBzY29yZSUyQyUyMHVwZGF0ZSUzQSUyMGJvb2wlMjAlM0QlMjBGYWxzZSUwQSklM0ElMEElMjAlMjAlMjAlMjAlMjMlMjAlNUIuLi4lNUQlMEElMjAlMjAlMjAlMjByZXR1cm4lMjByZXBvcnQ=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">create_markdown_report</span>(<span class="hljs-params">
    desired_metadata_dictionary, repo_name, repo_type, score, update: <span class="hljs-built_in">bool</span> = <span class="hljs-literal">False</span>
</span>):
    <span class="hljs-comment"># [...]</span>
    <span class="hljs-keyword">return</span> report`}}),Re=new U({}),Ne=new R({props:{code:"ZGVmJTIwY3JlYXRlX29yX3VwZGF0ZV9yZXBvcnQoZGF0YSklM0ElMEElMjAlMjAlMjAlMjBpZiUyMHBhcnNlZF9wb3N0JTIwJTNBJTNEJTIwcGFyc2Vfd2ViaG9va19wb3N0KGRhdGEpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmVwb190eXBlJTJDJTIwcmVwb19uYW1lJTIwJTNEJTIwcGFyc2VkX3Bvc3QlMEElMjAlMjAlMjAlMjBlbHNlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwUmVzcG9uc2UoJTIyVW5hYmxlJTIwdG8lMjBwYXJzZSUyMHdlYmhvb2slMjBkYXRhJTIyJTJDJTIwc3RhdHVzX2NvZGUlM0Q0MDApJTBBJTIwJTIwJTIwJTIwJTIzJTIwJTVCLi4uJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwVHJ1ZQ==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">create_or_update_report</span>(<span class="hljs-params">data</span>):
    <span class="hljs-keyword">if</span> parsed_post := parse_webhook_post(data):
        repo_type, repo_name = parsed_post
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> Response(<span class="hljs-string">&quot;Unable to parse webhook data&quot;</span>, status_code=<span class="hljs-number">400</span>)
    <span class="hljs-comment"># [...]</span>
    <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>`}}),ne=new Ir({props:{$$slots:{default:[Ji]},$$scope:{ctx:Q}}}),Xe=new U({}),Ge=new U({}),Ve=new U({}),de=new Ir({props:{$$slots:{default:[Ei]},$$scope:{ctx:Q}}}),Fe=new U({}),ze=new R({props:{code:"ZnJvbSUyMGZhc3RhcGklMjBpbXBvcnQlMjBGYXN0QVBJJTJDJTIwUmVxdWVzdCUyQyUyMFJlc3BvbnNlJTBBaW1wb3J0JTIwb3MlMEElMEFLRVklMjAlM0QlMjBvcy5lbnZpcm9uLmdldCglMjJXRUJIT09LX1NFQ1JFVCUyMiklMEElMEFhcHAlMjAlM0QlMjBGYXN0QVBJKCklMEElMEElNDBhcHAucG9zdCglMjIlMkZ3ZWJob29rJTIyKSUwQWFzeW5jJTIwZGVmJTIwd2ViaG9vayhyZXF1ZXN0JTNBJTIwUmVxdWVzdCklM0ElMEElMjAlMjAlMjAlMjBpZiUyMHJlcXVlc3QubWV0aG9kJTIwJTNEJTNEJTIwJTIyUE9TVCUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwcmVxdWVzdC5oZWFkZXJzLmdldCglMjJYLVdlYmhvb2stU2VjcmV0JTIyKSUyMCElM0QlMjBLRVklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBSZXNwb25zZSglMjJJbnZhbGlkJTIwc2VjcmV0JTIyJTJDJTIwc3RhdHVzX2NvZGUlM0Q0MDEpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZGF0YSUyMCUzRCUyMGF3YWl0JTIwcmVxdWVzdC5qc29uKCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXN1bHQlMjAlM0QlMjBjcmVhdGVfb3JfdXBkYXRlX3JlcG9ydChkYXRhKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCUyMldlYmhvb2slMjByZWNlaXZlZCElMjIlMjBpZiUyMHJlc3VsdCUyMGVsc2UlMjByZXN1bHQ=",highlighted:`<span class="hljs-keyword">from</span> fastapi <span class="hljs-keyword">import</span> FastAPI, Request, Response
<span class="hljs-keyword">import</span> os

KEY = os.environ.get(<span class="hljs-string">&quot;WEBHOOK_SECRET&quot;</span>)

app = FastAPI()

<span class="hljs-meta">@app.post(<span class="hljs-params"><span class="hljs-string">&quot;/webhook&quot;</span></span>)</span>
<span class="hljs-keyword">async</span> <span class="hljs-keyword">def</span> <span class="hljs-title function_">webhook</span>(<span class="hljs-params">request: Request</span>):
    <span class="hljs-keyword">if</span> request.method == <span class="hljs-string">&quot;POST&quot;</span>:
        <span class="hljs-keyword">if</span> request.headers.get(<span class="hljs-string">&quot;X-Webhook-Secret&quot;</span>) != KEY:
            <span class="hljs-keyword">return</span> Response(<span class="hljs-string">&quot;Invalid secret&quot;</span>, status_code=<span class="hljs-number">401</span>)
        data = <span class="hljs-keyword">await</span> request.json()
        result = create_or_update_report(data)
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;Webhook received!&quot;</span> <span class="hljs-keyword">if</span> result <span class="hljs-keyword">else</span> result`}}),Oe=new U({}),tt=new U({}),{c(){u=s("meta"),b=c(),j=s("h1"),T=s("a"),Ct=s("span"),f(Me.$$.fragment),eo=c(),Wt=s("span"),to=n("Webhook guide: Setup an automatic metadata quality review for models and datasets"),Ta=c(),f(L.$$.fragment),_a=c(),ot=s("p"),ao=n("This guide will walk you through creating a system that reacts to changes to a user\u2019s or organization\u2019s models or datasets on the Hub and creates a \u2018metadata review\u2019 for the changed repository."),Aa=c(),N=s("h2"),D=s("a"),Bt=s("span"),f(ve.$$.fragment),so=c(),St=s("span"),oo=n("What are we building and why?"),$a=c(),lt=s("p"),lo=n("Before we dive into the technical details involved in this particular workflow, we\u2019ll quickly outline what we\u2019re creating and why."),Ia=c(),J=s("p"),be=s("a"),ro=n("Model cards"),no=n(" and "),je=s("a"),io=n("dataset cards"),ho=n(" are essential tools for documenting machine learning models and datasets. The Hugging Face Hub uses a "),Zt=s("code"),po=n("README.md"),co=n(" file containing a "),ke=s("a"),uo=n("YAML"),fo=n(" header block to generate model and dataset cards. This "),Rt=s("code"),wo=n("YAML"),mo=n(" section defines metadata relating to the model or dataset. For example:"),Ua=c(),f(ge.$$.fragment),Ca=c(),z=s("p"),yo=n("This metadata contains essential information about your model or dataset for potential users. The license, for example, defines the terms under which a model or dataset can be used. Hub users can also use the fields defined in the "),Nt=s("code"),Mo=n("YAML"),vo=n(" metadata as filters for identifying models or datasets that fit specific criteria."),Wa=c(),O=s("p"),bo=n("Since the metadata defined in this block is essential for potential users of our models and datasets, it is important that we complete this section. In a team or organization setting, users pushing models and datasets to the Hub may have differing familiarity with the importance of this YAML metadata block. While someone in a team could take on the responsibility of reviewing this metadata, there may instead be some automation we can do to help us with this problem. The result will be a metadata review report automatically posted or updated when a repository on the Hub changes. For our metadata quality, this system works similarly to "),Je=s("a"),jo=n("CI/CD"),ko=n("."),Ba=c(),rt=s("p"),nt=s("img"),Sa=c(),K=s("p"),go=n("You can also find an example review "),Ee=s("a"),Jo=n("here"),Eo=n("."),Za=c(),X=s("h2"),ee=s("a"),Xt=s("span"),f(Te.$$.fragment),To=c(),Gt=s("span"),_o=n("Using the Hub Client Library to create a model review card"),Ra=c(),g=s("p"),Ao=n("The "),Yt=s("code"),$o=n("huggingface_hub"),Io=n(" is a Python library that allows you to interact with the Hub. We can use this library to "),_e=s("a"),Uo=n("download model and dataset cards"),Co=n(" from the Hub using the "),Pt=s("code"),Wo=n("DatasetCard.load"),Bo=n(" or "),xt=s("code"),So=n("ModelCard.load"),Zo=n(" methods. In particular, we\u2019ll use these methods to load a Python dictionary, which contains the metadata defined in the "),Ht=s("code"),Ro=n("YAML"),No=n(" of our model or dataset card. We\u2019ll create a small Python function to wrap these methods and do some exception handling."),Na=c(),f(Ae.$$.fragment),Xa=c(),it=s("p"),Xo=n("This function will return a Python dictionary containing the metadata associated with the repository (or an empty dictionary if there is no metadata)."),Ga=c(),f($e.$$.fragment),Ya=c(),G=s("h2"),te=s("a"),Vt=s("span"),f(Ie.$$.fragment),Go=c(),Ft=s("span"),Yo=n("Creating our metadata review report"),Pa=c(),ae=s("p"),Po=n("Once we have a Python dictionary containing the metadata associated with a repository, we\u2019ll create a \u2018report card\u2019 for our metadata review. In this particular instance, we\u2019ll review our metadata by defining some metadata fields for which we want values. For example, we may want to ensure that the "),qt=s("code"),xo=n("license"),Ho=n(" field has always been completed. To rate our metadata, we\u2019ll count which metadata fields are present out of our desired fields and return a percentage score based on the coverage of the required metadata fields we want to see values."),xa=c(),se=s("p"),Vo=n("Since we have a Python dictionary containing our metadata, we can loop through this dictionary to check if our desired keys are there. If a desired metadata field (a key in our dictionary) is missing, we\u2019ll assign the value as "),Qt=s("code"),Fo=n("None"),qo=n("."),Ha=c(),f(Ue.$$.fragment),Va=c(),C=s("p"),Qo=n("This function will return a dictionary containing keys representing the metadata fields we require for our model or dataset. The dictionary values will either include the metadata entered for that field or "),Lt=s("code"),Lo=n("None"),Do=n(" if that metadata field is missing in the "),Dt=s("code"),zo=n("YAML"),Oo=n("."),Fa=c(),f(Ce.$$.fragment),qa=c(),oe=s("p"),Ko=n("Once we have this dictionary, we can create our metadata report. In the interest of brevity, we won\u2019t include the complete code here, but the Hugging Face Spaces "),We=s("a"),el=n("repository"),tl=n(" for this Webhook contains the full code."),Qa=c(),ht=s("p"),al=n("We create one function which creates a markdown table that produces a prettier version of the data we have in our metadata coverage dictionary."),La=c(),f(Be.$$.fragment),Da=c(),pt=s("p"),sl=n("We also have a Python function that generates a score (representing the percentage of the desired metadata fields present)"),za=c(),f(Se.$$.fragment),Oa=c(),ct=s("p"),ol=n("and a Python function that creates a markdown report for our metadata review. This report contains both the score and metadata table, along with some explanation of what the report contains."),Ka=c(),f(Ze.$$.fragment),es=c(),Y=s("h2"),le=s("a"),zt=s("span"),f(Re.$$.fragment),ll=c(),Ot=s("span"),rl=n("How to post the review automatically?"),ts=c(),re=s("p"),nl=n("We now have a markdown formatted metadata review report. We\u2019ll use the "),Kt=s("code"),il=n("huggingface_hub"),hl=n(" library to post this review. We define a function that takes back the Webhook data received from the Hub, parses the data, and creates the metadata report. Depending on whether a report has previously been created, the function creates a new report or posts a new issue to an existing metadata review thread."),as=c(),f(Ne.$$.fragment),ss=c(),f(ne.$$.fragment),os=c(),P=s("h2"),ie=s("a"),ea=s("span"),f(Xe.$$.fragment),pl=c(),ta=s("span"),cl=n("Creating a Webhook to respond to changes on the Hub"),ls=c(),dt=s("p"),dl=n("We\u2019ve now got the core functionality for creating a metadata review report for a model or dataset. The next step is to use Webhooks to respond to changes automatically."),rs=c(),x=s("h2"),he=s("a"),aa=s("span"),f(Ge.$$.fragment),ul=c(),sa=s("span"),fl=n("Create a Webhook in your user profile"),ns=c(),pe=s("p"),wl=n("First, create your Webhook by going to "),Ye=s("a"),ml=n("https://huggingface.co/settings/webhooks"),yl=n("."),is=c(),W=s("ul"),oa=s("li"),Ml=n("Input a few target repositories that your Webhook will listen to (you will likely want to limit this to your own repositories or the repositories of the organization you belong to)."),vl=c(),Pe=s("li"),bl=n("Input a secret to make your Webhook more secure (if you don\u2019t know what to choose for this, you may want to use a "),xe=s("a"),jl=n("password generator"),kl=n(" to generate a sufficiently long random string for your secret)."),gl=c(),He=s("li"),Jl=n("We can pass a dummy URL for the "),la=s("code"),El=n("Webhook URL"),Tl=n(" parameter for now."),hs=c(),ut=s("p"),_l=n("Your Webhook will look like this:"),ps=c(),ft=s("p"),wt=s("img"),cs=c(),H=s("h2"),ce=s("a"),ra=s("span"),f(Ve.$$.fragment),Al=c(),na=s("span"),$l=n("Create a new Bot user profile"),ds=c(),mt=s("p"),Il=n("This guide creates a separate user account that will post the metadata reviews."),us=c(),yt=s("p"),Mt=s("img"),fs=c(),f(de.$$.fragment),ws=c(),V=s("h2"),ue=s("a"),ia=s("span"),f(Fe.$$.fragment),Ul=c(),ha=s("span"),Cl=n("Create a Webhook listener"),ms=c(),A=s("p"),Wl=n("We now need some way of listening to Webhook events. There are many possible tools you can use to listen to Webhook events. Many existing services, such as "),qe=s("a"),Bl=n("Zapier"),Sl=n(" and "),Qe=s("a"),Zl=n("IFTTT"),Rl=n(", can use Webhooks to trigger actions (for example, they could post a tweet every time a model is updated). In this case, we\u2019ll implement our Webhook listener using  "),Le=s("a"),Nl=n("FastAPI"),Xl=n("."),ys=c(),k=s("p"),De=s("a"),Gl=n("FastAPI"),Yl=n(" is a Python web framework. We\u2019ll use FastAPI to create a Webhook listener. In particular, we need to implement a route that accepts "),pa=s("code"),Pl=n("POST"),xl=n(" requests on "),ca=s("code"),Hl=n("/webhook"),Vl=n(". For authentication, we\u2019ll compare the "),da=s("code"),Fl=n("X-Webhook-Secret"),ql=n(" header with a "),ua=s("code"),Ql=n("WEBHOOK_SECRET"),Ll=n(" secret that can be passed to our "),vt=s("a"),Dl=n("Docker container at runtime"),zl=n("."),Ms=c(),f(ze.$$.fragment),vs=c(),bt=s("p"),Ol=n("The above function will receive Webhook events and creates or updates the metadata review report for the changed repository."),bs=c(),F=s("h2"),fe=s("a"),fa=s("span"),f(Oe.$$.fragment),Kl=c(),wa=s("span"),er=n("Use Spaces to deploy our Webhook app"),js=c(),B=s("p"),tr=n("Our "),Ke=s("a"),ar=n("main.py"),sr=n(" file contains all the code we need for our Webhook app. To deploy it, we\u2019ll use a "),jt=s("a"),or=n("Space"),lr=n("."),ks=c(),E=s("p"),rr=n("For our Space, we\u2019ll use Docker to run our app. The "),et=s("a"),nr=n("Dockerfile"),ir=n(" copies our app file, installs the required dependencies, and runs the application. To populate the "),ma=s("code"),hr=n("KEY"),pr=n(" variable, we\u2019ll also set a "),ya=s("code"),cr=n("WEBHOOK_SECRET"),dr=n(" secret for our Space with the secret we generated earlier. You can read more about Docker Spaces "),kt=s("a"),ur=n("here"),fr=n("."),gs=c(),gt=s("p"),wr=n("Finally, we need to update the URL in our Webhook settings to the URL of our Space. We can get our Space\u2019s \u201Cdirect URL\u201D from the contextual menu. Click on \u201CEmbed this Space\u201D and copy the \u201CDirect URL\u201D."),Js=c(),Jt=s("p"),Et=s("img"),Es=c(),we=s("p"),mr=n("Once we have this URL, we can pass this to the "),Ma=s("code"),yr=n("Webhook URL"),Mr=n(" parameter in our Webhook settings. Our bot should now start posting reviews when monitored repositories change!"),Ts=c(),q=s("h2"),me=s("a"),va=s("span"),f(tt.$$.fragment),vr=c(),ba=s("span"),br=n("Conclusion and next steps"),_s=c(),Tt=s("p"),jr=n("We now have an automatic metadata review bot! Here are some ideas for how you could build on this guide:"),As=c(),S=s("ul"),ja=s("li"),kr=n("The metadata review done by our bot was relatively crude; you could add more complex rules for reviewing metadata."),gr=c(),at=s("li"),Jr=n("You could use the full "),ka=s("code"),Er=n("README.md"),Tr=n(" file for doing the review."),_r=c(),ga=s("li"),Ar=n("You may want to define \u2018rules\u2019 which are particularly important for your organization and use a webhook to check these are followed."),$s=c(),_t=s("p"),$r=n("If you build a metadata quality app using Webhooks, please tag me @davanstrien; I would love to know about it!"),this.h()},l(e){const l=ji('[data-svelte="svelte-1phssyn"]',document.head);u=o(l,"META",{name:!0,content:!0}),l.forEach(t),b=d(e),j=o(e,"H1",{class:!0});var st=r(j);T=o(st,"A",{id:!0,class:!0,href:!0});var Ja=r(T);Ct=o(Ja,"SPAN",{});var Ea=r(Ct);w(Me.$$.fragment,Ea),Ea.forEach(t),Ja.forEach(t),eo=d(st),Wt=o(st,"SPAN",{});var Sr=r(Wt);to=i(Sr,"Webhook guide: Setup an automatic metadata quality review for models and datasets"),Sr.forEach(t),st.forEach(t),Ta=d(e),w(L.$$.fragment,e),_a=d(e),ot=o(e,"P",{});var Zr=r(ot);ao=i(Zr,"This guide will walk you through creating a system that reacts to changes to a user\u2019s or organization\u2019s models or datasets on the Hub and creates a \u2018metadata review\u2019 for the changed repository."),Zr.forEach(t),Aa=d(e),N=o(e,"H2",{class:!0});var Us=r(N);D=o(Us,"A",{id:!0,class:!0,href:!0});var Rr=r(D);Bt=o(Rr,"SPAN",{});var Nr=r(Bt);w(ve.$$.fragment,Nr),Nr.forEach(t),Rr.forEach(t),so=d(Us),St=o(Us,"SPAN",{});var Xr=r(St);oo=i(Xr,"What are we building and why?"),Xr.forEach(t),Us.forEach(t),$a=d(e),lt=o(e,"P",{});var Gr=r(lt);lo=i(Gr,"Before we dive into the technical details involved in this particular workflow, we\u2019ll quickly outline what we\u2019re creating and why."),Gr.forEach(t),Ia=d(e),J=o(e,"P",{});var I=r(J);be=o(I,"A",{href:!0,rel:!0});var Yr=r(be);ro=i(Yr,"Model cards"),Yr.forEach(t),no=i(I," and "),je=o(I,"A",{href:!0,rel:!0});var Pr=r(je);io=i(Pr,"dataset cards"),Pr.forEach(t),ho=i(I," are essential tools for documenting machine learning models and datasets. The Hugging Face Hub uses a "),Zt=o(I,"CODE",{});var xr=r(Zt);po=i(xr,"README.md"),xr.forEach(t),co=i(I," file containing a "),ke=o(I,"A",{href:!0,rel:!0});var Hr=r(ke);uo=i(Hr,"YAML"),Hr.forEach(t),fo=i(I," header block to generate model and dataset cards. This "),Rt=o(I,"CODE",{});var Vr=r(Rt);wo=i(Vr,"YAML"),Vr.forEach(t),mo=i(I," section defines metadata relating to the model or dataset. For example:"),I.forEach(t),Ua=d(e),w(ge.$$.fragment,e),Ca=d(e),z=o(e,"P",{});var Cs=r(z);yo=i(Cs,"This metadata contains essential information about your model or dataset for potential users. The license, for example, defines the terms under which a model or dataset can be used. Hub users can also use the fields defined in the "),Nt=o(Cs,"CODE",{});var Fr=r(Nt);Mo=i(Fr,"YAML"),Fr.forEach(t),vo=i(Cs," metadata as filters for identifying models or datasets that fit specific criteria."),Cs.forEach(t),Wa=d(e),O=o(e,"P",{});var Ws=r(O);bo=i(Ws,"Since the metadata defined in this block is essential for potential users of our models and datasets, it is important that we complete this section. In a team or organization setting, users pushing models and datasets to the Hub may have differing familiarity with the importance of this YAML metadata block. While someone in a team could take on the responsibility of reviewing this metadata, there may instead be some automation we can do to help us with this problem. The result will be a metadata review report automatically posted or updated when a repository on the Hub changes. For our metadata quality, this system works similarly to "),Je=o(Ws,"A",{href:!0,rel:!0});var qr=r(Je);jo=i(qr,"CI/CD"),qr.forEach(t),ko=i(Ws,"."),Ws.forEach(t),Ba=d(e),rt=o(e,"P",{});var Qr=r(rt);nt=o(Qr,"IMG",{src:!0,alt:!0}),Qr.forEach(t),Sa=d(e),K=o(e,"P",{});var Bs=r(K);go=i(Bs,"You can also find an example review "),Ee=o(Bs,"A",{href:!0,rel:!0});var Lr=r(Ee);Jo=i(Lr,"here"),Lr.forEach(t),Eo=i(Bs,"."),Bs.forEach(t),Za=d(e),X=o(e,"H2",{class:!0});var Ss=r(X);ee=o(Ss,"A",{id:!0,class:!0,href:!0});var Dr=r(ee);Xt=o(Dr,"SPAN",{});var zr=r(Xt);w(Te.$$.fragment,zr),zr.forEach(t),Dr.forEach(t),To=d(Ss),Gt=o(Ss,"SPAN",{});var Or=r(Gt);_o=i(Or,"Using the Hub Client Library to create a model review card"),Or.forEach(t),Ss.forEach(t),Ra=d(e),g=o(e,"P",{});var $=r(g);Ao=i($,"The "),Yt=o($,"CODE",{});var Kr=r(Yt);$o=i(Kr,"huggingface_hub"),Kr.forEach(t),Io=i($," is a Python library that allows you to interact with the Hub. We can use this library to "),_e=o($,"A",{href:!0,rel:!0});var en=r(_e);Uo=i(en,"download model and dataset cards"),en.forEach(t),Co=i($," from the Hub using the "),Pt=o($,"CODE",{});var tn=r(Pt);Wo=i(tn,"DatasetCard.load"),tn.forEach(t),Bo=i($," or "),xt=o($,"CODE",{});var an=r(xt);So=i(an,"ModelCard.load"),an.forEach(t),Zo=i($," methods. In particular, we\u2019ll use these methods to load a Python dictionary, which contains the metadata defined in the "),Ht=o($,"CODE",{});var sn=r(Ht);Ro=i(sn,"YAML"),sn.forEach(t),No=i($," of our model or dataset card. We\u2019ll create a small Python function to wrap these methods and do some exception handling."),$.forEach(t),Na=d(e),w(Ae.$$.fragment,e),Xa=d(e),it=o(e,"P",{});var on=r(it);Xo=i(on,"This function will return a Python dictionary containing the metadata associated with the repository (or an empty dictionary if there is no metadata)."),on.forEach(t),Ga=d(e),w($e.$$.fragment,e),Ya=d(e),G=o(e,"H2",{class:!0});var Zs=r(G);te=o(Zs,"A",{id:!0,class:!0,href:!0});var ln=r(te);Vt=o(ln,"SPAN",{});var rn=r(Vt);w(Ie.$$.fragment,rn),rn.forEach(t),ln.forEach(t),Go=d(Zs),Ft=o(Zs,"SPAN",{});var nn=r(Ft);Yo=i(nn,"Creating our metadata review report"),nn.forEach(t),Zs.forEach(t),Pa=d(e),ae=o(e,"P",{});var Rs=r(ae);Po=i(Rs,"Once we have a Python dictionary containing the metadata associated with a repository, we\u2019ll create a \u2018report card\u2019 for our metadata review. In this particular instance, we\u2019ll review our metadata by defining some metadata fields for which we want values. For example, we may want to ensure that the "),qt=o(Rs,"CODE",{});var hn=r(qt);xo=i(hn,"license"),hn.forEach(t),Ho=i(Rs," field has always been completed. To rate our metadata, we\u2019ll count which metadata fields are present out of our desired fields and return a percentage score based on the coverage of the required metadata fields we want to see values."),Rs.forEach(t),xa=d(e),se=o(e,"P",{});var Ns=r(se);Vo=i(Ns,"Since we have a Python dictionary containing our metadata, we can loop through this dictionary to check if our desired keys are there. If a desired metadata field (a key in our dictionary) is missing, we\u2019ll assign the value as "),Qt=o(Ns,"CODE",{});var pn=r(Qt);Fo=i(pn,"None"),pn.forEach(t),qo=i(Ns,"."),Ns.forEach(t),Ha=d(e),w(Ue.$$.fragment,e),Va=d(e),C=o(e,"P",{});var At=r(C);Qo=i(At,"This function will return a dictionary containing keys representing the metadata fields we require for our model or dataset. The dictionary values will either include the metadata entered for that field or "),Lt=o(At,"CODE",{});var cn=r(Lt);Lo=i(cn,"None"),cn.forEach(t),Do=i(At," if that metadata field is missing in the "),Dt=o(At,"CODE",{});var dn=r(Dt);zo=i(dn,"YAML"),dn.forEach(t),Oo=i(At,"."),At.forEach(t),Fa=d(e),w(Ce.$$.fragment,e),qa=d(e),oe=o(e,"P",{});var Xs=r(oe);Ko=i(Xs,"Once we have this dictionary, we can create our metadata report. In the interest of brevity, we won\u2019t include the complete code here, but the Hugging Face Spaces "),We=o(Xs,"A",{href:!0,rel:!0});var un=r(We);el=i(un,"repository"),un.forEach(t),tl=i(Xs," for this Webhook contains the full code."),Xs.forEach(t),Qa=d(e),ht=o(e,"P",{});var fn=r(ht);al=i(fn,"We create one function which creates a markdown table that produces a prettier version of the data we have in our metadata coverage dictionary."),fn.forEach(t),La=d(e),w(Be.$$.fragment,e),Da=d(e),pt=o(e,"P",{});var wn=r(pt);sl=i(wn,"We also have a Python function that generates a score (representing the percentage of the desired metadata fields present)"),wn.forEach(t),za=d(e),w(Se.$$.fragment,e),Oa=d(e),ct=o(e,"P",{});var mn=r(ct);ol=i(mn,"and a Python function that creates a markdown report for our metadata review. This report contains both the score and metadata table, along with some explanation of what the report contains."),mn.forEach(t),Ka=d(e),w(Ze.$$.fragment,e),es=d(e),Y=o(e,"H2",{class:!0});var Gs=r(Y);le=o(Gs,"A",{id:!0,class:!0,href:!0});var yn=r(le);zt=o(yn,"SPAN",{});var Mn=r(zt);w(Re.$$.fragment,Mn),Mn.forEach(t),yn.forEach(t),ll=d(Gs),Ot=o(Gs,"SPAN",{});var vn=r(Ot);rl=i(vn,"How to post the review automatically?"),vn.forEach(t),Gs.forEach(t),ts=d(e),re=o(e,"P",{});var Ys=r(re);nl=i(Ys,"We now have a markdown formatted metadata review report. We\u2019ll use the "),Kt=o(Ys,"CODE",{});var bn=r(Kt);il=i(bn,"huggingface_hub"),bn.forEach(t),hl=i(Ys," library to post this review. We define a function that takes back the Webhook data received from the Hub, parses the data, and creates the metadata report. Depending on whether a report has previously been created, the function creates a new report or posts a new issue to an existing metadata review thread."),Ys.forEach(t),as=d(e),w(Ne.$$.fragment,e),ss=d(e),w(ne.$$.fragment,e),os=d(e),P=o(e,"H2",{class:!0});var Ps=r(P);ie=o(Ps,"A",{id:!0,class:!0,href:!0});var jn=r(ie);ea=o(jn,"SPAN",{});var kn=r(ea);w(Xe.$$.fragment,kn),kn.forEach(t),jn.forEach(t),pl=d(Ps),ta=o(Ps,"SPAN",{});var gn=r(ta);cl=i(gn,"Creating a Webhook to respond to changes on the Hub"),gn.forEach(t),Ps.forEach(t),ls=d(e),dt=o(e,"P",{});var Jn=r(dt);dl=i(Jn,"We\u2019ve now got the core functionality for creating a metadata review report for a model or dataset. The next step is to use Webhooks to respond to changes automatically."),Jn.forEach(t),rs=d(e),x=o(e,"H2",{class:!0});var xs=r(x);he=o(xs,"A",{id:!0,class:!0,href:!0});var En=r(he);aa=o(En,"SPAN",{});var Tn=r(aa);w(Ge.$$.fragment,Tn),Tn.forEach(t),En.forEach(t),ul=d(xs),sa=o(xs,"SPAN",{});var _n=r(sa);fl=i(_n,"Create a Webhook in your user profile"),_n.forEach(t),xs.forEach(t),ns=d(e),pe=o(e,"P",{});var Hs=r(pe);wl=i(Hs,"First, create your Webhook by going to "),Ye=o(Hs,"A",{href:!0,rel:!0});var An=r(Ye);ml=i(An,"https://huggingface.co/settings/webhooks"),An.forEach(t),yl=i(Hs,"."),Hs.forEach(t),is=d(e),W=o(e,"UL",{});var $t=r(W);oa=o($t,"LI",{});var $n=r(oa);Ml=i($n,"Input a few target repositories that your Webhook will listen to (you will likely want to limit this to your own repositories or the repositories of the organization you belong to)."),$n.forEach(t),vl=d($t),Pe=o($t,"LI",{});var Vs=r(Pe);bl=i(Vs,"Input a secret to make your Webhook more secure (if you don\u2019t know what to choose for this, you may want to use a "),xe=o(Vs,"A",{href:!0,rel:!0});var In=r(xe);jl=i(In,"password generator"),In.forEach(t),kl=i(Vs," to generate a sufficiently long random string for your secret)."),Vs.forEach(t),gl=d($t),He=o($t,"LI",{});var Fs=r(He);Jl=i(Fs,"We can pass a dummy URL for the "),la=o(Fs,"CODE",{});var Un=r(la);El=i(Un,"Webhook URL"),Un.forEach(t),Tl=i(Fs," parameter for now."),Fs.forEach(t),$t.forEach(t),hs=d(e),ut=o(e,"P",{});var Cn=r(ut);_l=i(Cn,"Your Webhook will look like this:"),Cn.forEach(t),ps=d(e),ft=o(e,"P",{});var Wn=r(ft);wt=o(Wn,"IMG",{src:!0,alt:!0}),Wn.forEach(t),cs=d(e),H=o(e,"H2",{class:!0});var qs=r(H);ce=o(qs,"A",{id:!0,class:!0,href:!0});var Bn=r(ce);ra=o(Bn,"SPAN",{});var Sn=r(ra);w(Ve.$$.fragment,Sn),Sn.forEach(t),Bn.forEach(t),Al=d(qs),na=o(qs,"SPAN",{});var Zn=r(na);$l=i(Zn,"Create a new Bot user profile"),Zn.forEach(t),qs.forEach(t),ds=d(e),mt=o(e,"P",{});var Rn=r(mt);Il=i(Rn,"This guide creates a separate user account that will post the metadata reviews."),Rn.forEach(t),us=d(e),yt=o(e,"P",{});var Nn=r(yt);Mt=o(Nn,"IMG",{src:!0,alt:!0}),Nn.forEach(t),fs=d(e),w(de.$$.fragment,e),ws=d(e),V=o(e,"H2",{class:!0});var Qs=r(V);ue=o(Qs,"A",{id:!0,class:!0,href:!0});var Xn=r(ue);ia=o(Xn,"SPAN",{});var Gn=r(ia);w(Fe.$$.fragment,Gn),Gn.forEach(t),Xn.forEach(t),Ul=d(Qs),ha=o(Qs,"SPAN",{});var Yn=r(ha);Cl=i(Yn,"Create a Webhook listener"),Yn.forEach(t),Qs.forEach(t),ms=d(e),A=o(e,"P",{});var ye=r(A);Wl=i(ye,"We now need some way of listening to Webhook events. There are many possible tools you can use to listen to Webhook events. Many existing services, such as "),qe=o(ye,"A",{href:!0,rel:!0});var Pn=r(qe);Bl=i(Pn,"Zapier"),Pn.forEach(t),Sl=i(ye," and "),Qe=o(ye,"A",{href:!0,rel:!0});var xn=r(Qe);Zl=i(xn,"IFTTT"),xn.forEach(t),Rl=i(ye,", can use Webhooks to trigger actions (for example, they could post a tweet every time a model is updated). In this case, we\u2019ll implement our Webhook listener using  "),Le=o(ye,"A",{href:!0,rel:!0});var Hn=r(Le);Nl=i(Hn,"FastAPI"),Hn.forEach(t),Xl=i(ye,"."),ye.forEach(t),ys=d(e),k=o(e,"P",{});var _=r(k);De=o(_,"A",{href:!0,rel:!0});var Vn=r(De);Gl=i(Vn,"FastAPI"),Vn.forEach(t),Yl=i(_," is a Python web framework. We\u2019ll use FastAPI to create a Webhook listener. In particular, we need to implement a route that accepts "),pa=o(_,"CODE",{});var Fn=r(pa);Pl=i(Fn,"POST"),Fn.forEach(t),xl=i(_," requests on "),ca=o(_,"CODE",{});var qn=r(ca);Hl=i(qn,"/webhook"),qn.forEach(t),Vl=i(_,". For authentication, we\u2019ll compare the "),da=o(_,"CODE",{});var Qn=r(da);Fl=i(Qn,"X-Webhook-Secret"),Qn.forEach(t),ql=i(_," header with a "),ua=o(_,"CODE",{});var Ln=r(ua);Ql=i(Ln,"WEBHOOK_SECRET"),Ln.forEach(t),Ll=i(_," secret that can be passed to our "),vt=o(_,"A",{href:!0});var Dn=r(vt);Dl=i(Dn,"Docker container at runtime"),Dn.forEach(t),zl=i(_,"."),_.forEach(t),Ms=d(e),w(ze.$$.fragment,e),vs=d(e),bt=o(e,"P",{});var zn=r(bt);Ol=i(zn,"The above function will receive Webhook events and creates or updates the metadata review report for the changed repository."),zn.forEach(t),bs=d(e),F=o(e,"H2",{class:!0});var Ls=r(F);fe=o(Ls,"A",{id:!0,class:!0,href:!0});var On=r(fe);fa=o(On,"SPAN",{});var Kn=r(fa);w(Oe.$$.fragment,Kn),Kn.forEach(t),On.forEach(t),Kl=d(Ls),wa=o(Ls,"SPAN",{});var ei=r(wa);er=i(ei,"Use Spaces to deploy our Webhook app"),ei.forEach(t),Ls.forEach(t),js=d(e),B=o(e,"P",{});var It=r(B);tr=i(It,"Our "),Ke=o(It,"A",{href:!0,rel:!0});var ti=r(Ke);ar=i(ti,"main.py"),ti.forEach(t),sr=i(It," file contains all the code we need for our Webhook app. To deploy it, we\u2019ll use a "),jt=o(It,"A",{href:!0});var ai=r(jt);or=i(ai,"Space"),ai.forEach(t),lr=i(It,"."),It.forEach(t),ks=d(e),E=o(e,"P",{});var Z=r(E);rr=i(Z,"For our Space, we\u2019ll use Docker to run our app. The "),et=o(Z,"A",{href:!0,rel:!0});var si=r(et);nr=i(si,"Dockerfile"),si.forEach(t),ir=i(Z," copies our app file, installs the required dependencies, and runs the application. To populate the "),ma=o(Z,"CODE",{});var oi=r(ma);hr=i(oi,"KEY"),oi.forEach(t),pr=i(Z," variable, we\u2019ll also set a "),ya=o(Z,"CODE",{});var li=r(ya);cr=i(li,"WEBHOOK_SECRET"),li.forEach(t),dr=i(Z," secret for our Space with the secret we generated earlier. You can read more about Docker Spaces "),kt=o(Z,"A",{href:!0});var ri=r(kt);ur=i(ri,"here"),ri.forEach(t),fr=i(Z,"."),Z.forEach(t),gs=d(e),gt=o(e,"P",{});var ni=r(gt);wr=i(ni,"Finally, we need to update the URL in our Webhook settings to the URL of our Space. We can get our Space\u2019s \u201Cdirect URL\u201D from the contextual menu. Click on \u201CEmbed this Space\u201D and copy the \u201CDirect URL\u201D."),ni.forEach(t),Js=d(e),Jt=o(e,"P",{});var ii=r(Jt);Et=o(ii,"IMG",{src:!0,alt:!0}),ii.forEach(t),Es=d(e),we=o(e,"P",{});var Ds=r(we);mr=i(Ds,"Once we have this URL, we can pass this to the "),Ma=o(Ds,"CODE",{});var hi=r(Ma);yr=i(hi,"Webhook URL"),hi.forEach(t),Mr=i(Ds," parameter in our Webhook settings. Our bot should now start posting reviews when monitored repositories change!"),Ds.forEach(t),Ts=d(e),q=o(e,"H2",{class:!0});var zs=r(q);me=o(zs,"A",{id:!0,class:!0,href:!0});var pi=r(me);va=o(pi,"SPAN",{});var ci=r(va);w(tt.$$.fragment,ci),ci.forEach(t),pi.forEach(t),vr=d(zs),ba=o(zs,"SPAN",{});var di=r(ba);br=i(di,"Conclusion and next steps"),di.forEach(t),zs.forEach(t),_s=d(e),Tt=o(e,"P",{});var ui=r(Tt);jr=i(ui,"We now have an automatic metadata review bot! Here are some ideas for how you could build on this guide:"),ui.forEach(t),As=d(e),S=o(e,"UL",{});var Ut=r(S);ja=o(Ut,"LI",{});var fi=r(ja);kr=i(fi,"The metadata review done by our bot was relatively crude; you could add more complex rules for reviewing metadata."),fi.forEach(t),gr=d(Ut),at=o(Ut,"LI",{});var Os=r(at);Jr=i(Os,"You could use the full "),ka=o(Os,"CODE",{});var wi=r(ka);Er=i(wi,"README.md"),wi.forEach(t),Tr=i(Os," file for doing the review."),Os.forEach(t),_r=d(Ut),ga=o(Ut,"LI",{});var mi=r(ga);Ar=i(mi,"You may want to define \u2018rules\u2019 which are particularly important for your organization and use a webhook to check these are followed."),mi.forEach(t),Ut.forEach(t),$s=d(e),_t=o(e,"P",{});var yi=r(_t);$r=i(yi,"If you build a metadata quality app using Webhooks, please tag me @davanstrien; I would love to know about it!"),yi.forEach(t),this.h()},h(){p(u,"name","hf:doc:metadata"),p(u,"content",JSON.stringify(_i)),p(T,"id","webhook-guide-setup-an-automatic-metadata-quality-review-for-models-and-datasets"),p(T,"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"),p(T,"href","#webhook-guide-setup-an-automatic-metadata-quality-review-for-models-and-datasets"),p(j,"class","relative group"),p(D,"id","what-are-we-building-and-why"),p(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"),p(D,"href","#what-are-we-building-and-why"),p(N,"class","relative group"),p(be,"href","https://huggingface.co/docs/hub/model-cards"),p(be,"rel","nofollow"),p(je,"href","https://huggingface.co/docs/hub/datasets-cards"),p(je,"rel","nofollow"),p(ke,"href","https://en.wikipedia.org/wiki/YAML"),p(ke,"rel","nofollow"),p(Je,"href","https://en.wikipedia.org/wiki/CI/CD"),p(Je,"rel","nofollow"),Ks(nt.src,Ur="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/003-metadata-review/metadata-report-screenshot.png")||p(nt,"src",Ur),p(nt,"alt","Metadata review"),p(Ee,"href","https://huggingface.co/datasets/davanstrien/test_webhook/discussions/1#63d932fe19aa7b8ed2718b3f"),p(Ee,"rel","nofollow"),p(ee,"id","using-the-hub-client-library-to-create-a-model-review-card"),p(ee,"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"),p(ee,"href","#using-the-hub-client-library-to-create-a-model-review-card"),p(X,"class","relative group"),p(_e,"href","https://huggingface.co/docs/huggingface_hub/how-to-model-cards"),p(_e,"rel","nofollow"),p(te,"id","creating-our-metadata-review-report"),p(te,"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"),p(te,"href","#creating-our-metadata-review-report"),p(G,"class","relative group"),p(We,"href","https://huggingface.co/spaces/librarian-bot/webhook_metadata_reviewer/blob/main/main.py"),p(We,"rel","nofollow"),p(le,"id","how-to-post-the-review-automatically"),p(le,"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"),p(le,"href","#how-to-post-the-review-automatically"),p(Y,"class","relative group"),p(ie,"id","creating-a-webhook-to-respond-to-changes-on-the-hub"),p(ie,"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"),p(ie,"href","#creating-a-webhook-to-respond-to-changes-on-the-hub"),p(P,"class","relative group"),p(he,"id","create-a-webhook-in-your-user-profile"),p(he,"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"),p(he,"href","#create-a-webhook-in-your-user-profile"),p(x,"class","relative group"),p(Ye,"href","https://huggingface.co/settings/webhooks"),p(Ye,"rel","nofollow"),p(xe,"href","https://1password.com/password-generator/"),p(xe,"rel","nofollow"),Ks(wt.src,Cr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/003-metadata-review/webhook-settings.png")||p(wt,"src",Cr),p(wt,"alt","webhook settings"),p(ce,"id","create-a-new-bot-user-profile"),p(ce,"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"),p(ce,"href","#create-a-new-bot-user-profile"),p(H,"class","relative group"),Ks(Mt.src,Wr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/003-metadata-review/librarian-bot-profile.png")||p(Mt,"src",Wr),p(Mt,"alt","Bot user account"),p(ue,"id","create-a-webhook-listener"),p(ue,"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"),p(ue,"href","#create-a-webhook-listener"),p(V,"class","relative group"),p(qe,"href","https://zapier.com/"),p(qe,"rel","nofollow"),p(Qe,"href","https://ifttt.com"),p(Qe,"rel","nofollow"),p(Le,"href","https://fastapi.tiangolo.com/"),p(Le,"rel","nofollow"),p(De,"href","https://fastapi.tiangolo.com/"),p(De,"rel","nofollow"),p(vt,"href","./spaces-sdks-docker#runtime"),p(fe,"id","use-spaces-to-deploy-our-webhook-app"),p(fe,"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"),p(fe,"href","#use-spaces-to-deploy-our-webhook-app"),p(F,"class","relative group"),p(Ke,"href","https://huggingface.co/spaces/librarian-bot/webhook_metadata_reviewer/blob/main/main.py"),p(Ke,"rel","nofollow"),p(jt,"href","./spaces-overview"),p(et,"href","https://huggingface.co/spaces/librarian-bot/webhook_metadata_reviewer/blob/main/Dockerfile"),p(et,"rel","nofollow"),p(kt,"href","./spaces-sdks-docker"),Ks(Et.src,Br="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/003-metadata-review/direct-url.png")||p(Et,"src",Br),p(Et,"alt","direct url"),p(me,"id","conclusion-and-next-steps"),p(me,"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"),p(me,"href","#conclusion-and-next-steps"),p(q,"class","relative group")},m(e,l){a(document.head,u),h(e,b,l),h(e,j,l),a(j,T),a(T,Ct),m(Me,Ct,null),a(j,eo),a(j,Wt),a(Wt,to),h(e,Ta,l),m(L,e,l),h(e,_a,l),h(e,ot,l),a(ot,ao),h(e,Aa,l),h(e,N,l),a(N,D),a(D,Bt),m(ve,Bt,null),a(N,so),a(N,St),a(St,oo),h(e,$a,l),h(e,lt,l),a(lt,lo),h(e,Ia,l),h(e,J,l),a(J,be),a(be,ro),a(J,no),a(J,je),a(je,io),a(J,ho),a(J,Zt),a(Zt,po),a(J,co),a(J,ke),a(ke,uo),a(J,fo),a(J,Rt),a(Rt,wo),a(J,mo),h(e,Ua,l),m(ge,e,l),h(e,Ca,l),h(e,z,l),a(z,yo),a(z,Nt),a(Nt,Mo),a(z,vo),h(e,Wa,l),h(e,O,l),a(O,bo),a(O,Je),a(Je,jo),a(O,ko),h(e,Ba,l),h(e,rt,l),a(rt,nt),h(e,Sa,l),h(e,K,l),a(K,go),a(K,Ee),a(Ee,Jo),a(K,Eo),h(e,Za,l),h(e,X,l),a(X,ee),a(ee,Xt),m(Te,Xt,null),a(X,To),a(X,Gt),a(Gt,_o),h(e,Ra,l),h(e,g,l),a(g,Ao),a(g,Yt),a(Yt,$o),a(g,Io),a(g,_e),a(_e,Uo),a(g,Co),a(g,Pt),a(Pt,Wo),a(g,Bo),a(g,xt),a(xt,So),a(g,Zo),a(g,Ht),a(Ht,Ro),a(g,No),h(e,Na,l),m(Ae,e,l),h(e,Xa,l),h(e,it,l),a(it,Xo),h(e,Ga,l),m($e,e,l),h(e,Ya,l),h(e,G,l),a(G,te),a(te,Vt),m(Ie,Vt,null),a(G,Go),a(G,Ft),a(Ft,Yo),h(e,Pa,l),h(e,ae,l),a(ae,Po),a(ae,qt),a(qt,xo),a(ae,Ho),h(e,xa,l),h(e,se,l),a(se,Vo),a(se,Qt),a(Qt,Fo),a(se,qo),h(e,Ha,l),m(Ue,e,l),h(e,Va,l),h(e,C,l),a(C,Qo),a(C,Lt),a(Lt,Lo),a(C,Do),a(C,Dt),a(Dt,zo),a(C,Oo),h(e,Fa,l),m(Ce,e,l),h(e,qa,l),h(e,oe,l),a(oe,Ko),a(oe,We),a(We,el),a(oe,tl),h(e,Qa,l),h(e,ht,l),a(ht,al),h(e,La,l),m(Be,e,l),h(e,Da,l),h(e,pt,l),a(pt,sl),h(e,za,l),m(Se,e,l),h(e,Oa,l),h(e,ct,l),a(ct,ol),h(e,Ka,l),m(Ze,e,l),h(e,es,l),h(e,Y,l),a(Y,le),a(le,zt),m(Re,zt,null),a(Y,ll),a(Y,Ot),a(Ot,rl),h(e,ts,l),h(e,re,l),a(re,nl),a(re,Kt),a(Kt,il),a(re,hl),h(e,as,l),m(Ne,e,l),h(e,ss,l),m(ne,e,l),h(e,os,l),h(e,P,l),a(P,ie),a(ie,ea),m(Xe,ea,null),a(P,pl),a(P,ta),a(ta,cl),h(e,ls,l),h(e,dt,l),a(dt,dl),h(e,rs,l),h(e,x,l),a(x,he),a(he,aa),m(Ge,aa,null),a(x,ul),a(x,sa),a(sa,fl),h(e,ns,l),h(e,pe,l),a(pe,wl),a(pe,Ye),a(Ye,ml),a(pe,yl),h(e,is,l),h(e,W,l),a(W,oa),a(oa,Ml),a(W,vl),a(W,Pe),a(Pe,bl),a(Pe,xe),a(xe,jl),a(Pe,kl),a(W,gl),a(W,He),a(He,Jl),a(He,la),a(la,El),a(He,Tl),h(e,hs,l),h(e,ut,l),a(ut,_l),h(e,ps,l),h(e,ft,l),a(ft,wt),h(e,cs,l),h(e,H,l),a(H,ce),a(ce,ra),m(Ve,ra,null),a(H,Al),a(H,na),a(na,$l),h(e,ds,l),h(e,mt,l),a(mt,Il),h(e,us,l),h(e,yt,l),a(yt,Mt),h(e,fs,l),m(de,e,l),h(e,ws,l),h(e,V,l),a(V,ue),a(ue,ia),m(Fe,ia,null),a(V,Ul),a(V,ha),a(ha,Cl),h(e,ms,l),h(e,A,l),a(A,Wl),a(A,qe),a(qe,Bl),a(A,Sl),a(A,Qe),a(Qe,Zl),a(A,Rl),a(A,Le),a(Le,Nl),a(A,Xl),h(e,ys,l),h(e,k,l),a(k,De),a(De,Gl),a(k,Yl),a(k,pa),a(pa,Pl),a(k,xl),a(k,ca),a(ca,Hl),a(k,Vl),a(k,da),a(da,Fl),a(k,ql),a(k,ua),a(ua,Ql),a(k,Ll),a(k,vt),a(vt,Dl),a(k,zl),h(e,Ms,l),m(ze,e,l),h(e,vs,l),h(e,bt,l),a(bt,Ol),h(e,bs,l),h(e,F,l),a(F,fe),a(fe,fa),m(Oe,fa,null),a(F,Kl),a(F,wa),a(wa,er),h(e,js,l),h(e,B,l),a(B,tr),a(B,Ke),a(Ke,ar),a(B,sr),a(B,jt),a(jt,or),a(B,lr),h(e,ks,l),h(e,E,l),a(E,rr),a(E,et),a(et,nr),a(E,ir),a(E,ma),a(ma,hr),a(E,pr),a(E,ya),a(ya,cr),a(E,dr),a(E,kt),a(kt,ur),a(E,fr),h(e,gs,l),h(e,gt,l),a(gt,wr),h(e,Js,l),h(e,Jt,l),a(Jt,Et),h(e,Es,l),h(e,we,l),a(we,mr),a(we,Ma),a(Ma,yr),a(we,Mr),h(e,Ts,l),h(e,q,l),a(q,me),a(me,va),m(tt,va,null),a(q,vr),a(q,ba),a(ba,br),h(e,_s,l),h(e,Tt,l),a(Tt,jr),h(e,As,l),h(e,S,l),a(S,ja),a(ja,kr),a(S,gr),a(S,at),a(at,Jr),a(at,ka),a(ka,Er),a(at,Tr),a(S,_r),a(S,ga),a(ga,Ar),h(e,$s,l),h(e,_t,l),a(_t,$r),Is=!0},p(e,[l]){const st={};l&2&&(st.$$scope={dirty:l,ctx:e}),L.$set(st);const Ja={};l&2&&(Ja.$$scope={dirty:l,ctx:e}),ne.$set(Ja);const Ea={};l&2&&(Ea.$$scope={dirty:l,ctx:e}),de.$set(Ea)},i(e){Is||(y(Me.$$.fragment,e),y(L.$$.fragment,e),y(ve.$$.fragment,e),y(ge.$$.fragment,e),y(Te.$$.fragment,e),y(Ae.$$.fragment,e),y($e.$$.fragment,e),y(Ie.$$.fragment,e),y(Ue.$$.fragment,e),y(Ce.$$.fragment,e),y(Be.$$.fragment,e),y(Se.$$.fragment,e),y(Ze.$$.fragment,e),y(Re.$$.fragment,e),y(Ne.$$.fragment,e),y(ne.$$.fragment,e),y(Xe.$$.fragment,e),y(Ge.$$.fragment,e),y(Ve.$$.fragment,e),y(de.$$.fragment,e),y(Fe.$$.fragment,e),y(ze.$$.fragment,e),y(Oe.$$.fragment,e),y(tt.$$.fragment,e),Is=!0)},o(e){M(Me.$$.fragment,e),M(L.$$.fragment,e),M(ve.$$.fragment,e),M(ge.$$.fragment,e),M(Te.$$.fragment,e),M(Ae.$$.fragment,e),M($e.$$.fragment,e),M(Ie.$$.fragment,e),M(Ue.$$.fragment,e),M(Ce.$$.fragment,e),M(Be.$$.fragment,e),M(Se.$$.fragment,e),M(Ze.$$.fragment,e),M(Re.$$.fragment,e),M(Ne.$$.fragment,e),M(ne.$$.fragment,e),M(Xe.$$.fragment,e),M(Ge.$$.fragment,e),M(Ve.$$.fragment,e),M(de.$$.fragment,e),M(Fe.$$.fragment,e),M(ze.$$.fragment,e),M(Oe.$$.fragment,e),M(tt.$$.fragment,e),Is=!1},d(e){t(u),e&&t(b),e&&t(j),v(Me),e&&t(Ta),v(L,e),e&&t(_a),e&&t(ot),e&&t(Aa),e&&t(N),v(ve),e&&t($a),e&&t(lt),e&&t(Ia),e&&t(J),e&&t(Ua),v(ge,e),e&&t(Ca),e&&t(z),e&&t(Wa),e&&t(O),e&&t(Ba),e&&t(rt),e&&t(Sa),e&&t(K),e&&t(Za),e&&t(X),v(Te),e&&t(Ra),e&&t(g),e&&t(Na),v(Ae,e),e&&t(Xa),e&&t(it),e&&t(Ga),v($e,e),e&&t(Ya),e&&t(G),v(Ie),e&&t(Pa),e&&t(ae),e&&t(xa),e&&t(se),e&&t(Ha),v(Ue,e),e&&t(Va),e&&t(C),e&&t(Fa),v(Ce,e),e&&t(qa),e&&t(oe),e&&t(Qa),e&&t(ht),e&&t(La),v(Be,e),e&&t(Da),e&&t(pt),e&&t(za),v(Se,e),e&&t(Oa),e&&t(ct),e&&t(Ka),v(Ze,e),e&&t(es),e&&t(Y),v(Re),e&&t(ts),e&&t(re),e&&t(as),v(Ne,e),e&&t(ss),v(ne,e),e&&t(os),e&&t(P),v(Xe),e&&t(ls),e&&t(dt),e&&t(rs),e&&t(x),v(Ge),e&&t(ns),e&&t(pe),e&&t(is),e&&t(W),e&&t(hs),e&&t(ut),e&&t(ps),e&&t(ft),e&&t(cs),e&&t(H),v(Ve),e&&t(ds),e&&t(mt),e&&t(us),e&&t(yt),e&&t(fs),v(de,e),e&&t(ws),e&&t(V),v(Fe),e&&t(ms),e&&t(A),e&&t(ys),e&&t(k),e&&t(Ms),v(ze,e),e&&t(vs),e&&t(bt),e&&t(bs),e&&t(F),v(Oe),e&&t(js),e&&t(B),e&&t(ks),e&&t(E),e&&t(gs),e&&t(gt),e&&t(Js),e&&t(Jt),e&&t(Es),e&&t(we),e&&t(Ts),e&&t(q),v(tt),e&&t(_s),e&&t(Tt),e&&t(As),e&&t(S),e&&t($s),e&&t(_t)}}}const _i={local:"webhook-guide-setup-an-automatic-metadata-quality-review-for-models-and-datasets",sections:[{local:"what-are-we-building-and-why",title:"What are we building and why?"},{local:"using-the-hub-client-library-to-create-a-model-review-card",title:"Using the Hub Client Library to create a model review card "},{local:"creating-our-metadata-review-report",title:"Creating our metadata review report"},{local:"how-to-post-the-review-automatically",title:"How to post the review automatically?"},{local:"creating-a-webhook-to-respond-to-changes-on-the-hub",title:"Creating a Webhook to respond to changes on the Hub"},{local:"create-a-webhook-in-your-user-profile",title:"Create a Webhook in your user profile"},{local:"create-a-new-bot-user-profile",title:"Create a new Bot user profile"},{local:"create-a-webhook-listener",title:"Create a Webhook listener"},{local:"use-spaces-to-deploy-our-webhook-app",title:"Use Spaces to deploy our Webhook app "},{local:"conclusion-and-next-steps",title:"Conclusion and next steps"}],title:"Webhook guide: Setup an automatic metadata quality review for models and datasets "};function Ai(Q){return ki(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Wi extends Mi{constructor(u){super();vi(this,u,Ai,Ti,bi,{})}}export{Wi as default,_i as metadata};
