import{S as _o,i as Uo,s as Bo,e as a,k as h,w as b,t as r,N as Wo,c as l,d as t,m as u,a as n,x as j,h as i,b as c,P as Ke,G as s,g as p,y as v,q as M,o as T,B as J,v as Io}from"../chunks/vendor-hf-doc-builder.js";import{T as So}from"../chunks/Tip-hf-doc-builder.js";import{I as gt}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as _t}from"../chunks/CodeBlock-hf-doc-builder.js";function Ao(Ut){let f,A;return{c(){f=a("p"),A=r("Webhooks are now publicly available!")},l(d){f=l(d,"P",{});var m=n(f);A=i(m,"Webhooks are now publicly available!"),m.forEach(t)},m(d,m){p(d,f,m),s(f,A)},d(d){d&&t(f)}}}function Ro(Ut){let f,A,d,m,et,O,Bs,tt,Ws,Bt,R,Wt,Ee,Is,It,k,Ss,z,As,Rs,D,$s,Zs,St,_,$,st,x,Vs,at,Cs,At,E,Gs,K,Hs,Ns,ee,qs,Qs,Rt,ge,_e,cl,$t,U,Z,lt,te,Ys,ot,Ps,Zt,V,Xs,se,Fs,Ls,Vt,w,ae,Os,le,zs,Ds,xs,nt,Ks,ea,rt,ta,sa,it,aa,Ct,Ue,la,Gt,Be,We,hl,Ht,B,C,pt,oe,oa,ct,na,Nt,G,ra,ne,ia,pa,qt,H,ca,re,ha,ua,Qt,y,fa,ie,da,ma,pe,wa,ya,ce,ba,ja,Yt,N,va,he,Ma,Ta,Pt,Ie,W,Ja,ht,ka,Ea,ut,ga,_a,Xt,ue,Ft,fe,ft,Se,I,Ua,dt,Ba,Wa,mt,Ia,Sa,Lt,de,Ot,me,wt,Aa,zt,q,yt,Ra,$a,bt,Za,Dt,we,xt,ye,be,Va,jt,Ca,Ga,Kt,je,es,Ae,Ha,ts,Re,$e,ul,ss,Ze,Na,as,Ve,qa,ls,Q,Ce,vt,Qa,Ya,Pa,g,Mt,Xa,Fa,Tt,La,Oa,ve,za,Da,os,Y,xa,P,Jt,Ka,el,tl,ns,Me,rs,S,X,kt,Te,sl,Et,al,is,Ge,ll,ps,He,ol,cs,Ne,qe,fl,hs,Qe,Ye,dl,us,Pe,nl,fs,Xe,Fe,ml,ds,Le,rl,ms;return O=new gt({}),R=new So({props:{$$slots:{default:[Ao]},$$scope:{ctx:Ut}}}),x=new gt({}),te=new gt({}),oe=new gt({}),ue=new _t({props:{code:"ZnJvbSUyMGZhc3RhcGklMjBpbXBvcnQlMjBGYXN0QVBJJTBBJTBBJTIzJTIwJTVCLi4uJTVEJTBBJTQwYXBwLnBvc3QoJTIyJTJGd2ViaG9vayUyMiklMEFhc3luYyUyMGRlZiUyMHBvc3Rfd2ViaG9vayglMEElMDklMjMlMjAuLi4lMEEpJTNBJTBBJTBBJTIzJTIwLi4u",highlighted:`<span class="hljs-keyword">from</span> fastapi <span class="hljs-keyword">import</span> FastAPI

<span class="hljs-comment"># [...]</span>
<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_">post_webhook</span>(<span class="hljs-params">
	<span class="hljs-comment"># ...</span>
</span>):

<span class="hljs-comment"># ...</span>`}}),de=new _t({props:{code:"JTIzJTIwJTVCLi4uJTVEJTBBJTBBV0VCSE9PS19TRUNSRVQlMjAlM0QlMjBvcy5nZXRlbnYoJTIyV0VCSE9PS19TRUNSRVQlMjIpJTBBJTBBJTIzJTIwJTVCLi4uJTVEJTBBJTBBJTQwYXBwLnBvc3QoJTIyJTJGd2ViaG9vayUyMiklMEFhc3luYyUyMGRlZiUyMHBvc3Rfd2ViaG9vayglMEElMDklMjMlMjAlNUIuLi4lNUQlMEElMDl4X3dlYmhvb2tfc2VjcmV0JTNBJTIwJTIwT3B0aW9uYWwlNUJzdHIlNUQlMjAlM0QlMjBIZWFkZXIoZGVmYXVsdCUzRE5vbmUpJTJDJTBBJTA5JTIzJTIwJTVFJTIwY2hlY2tzJTIwZm9yJTIwdGhlJTIwWC1XZWJob29rLVNlY3JldCUyMEhUVFAlMjBoZWFkZXIlMEEpJTNBJTBBJTA5aWYlMjB4X3dlYmhvb2tfc2VjcmV0JTIwaXMlMjBOb25lJTNBJTBBJTA5JTA5cmFpc2UlMjBIVFRQRXhjZXB0aW9uKDQwMSklMEElMDlpZiUyMHhfd2ViaG9va19zZWNyZXQlMjAhJTNEJTIwV0VCSE9PS19TRUNSRVQlM0ElMEElMDklMDlyYWlzZSUyMEhUVFBFeGNlcHRpb24oNDAzKSUwQSUwOSUyMyUyMCU1Qi4uLiU1RA==",highlighted:`<span class="hljs-comment"># [...]</span>

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

<span class="hljs-comment"># [...]</span>

<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_">post_webhook</span>(<span class="hljs-params">
	<span class="hljs-comment"># [...]</span>
	x_webhook_secret:  <span class="hljs-type">Optional</span>[<span class="hljs-built_in">str</span>] = Header(<span class="hljs-params">default=<span class="hljs-literal">None</span></span>),
	<span class="hljs-comment"># ^ checks for the X-Webhook-Secret HTTP header</span>
</span>):
	<span class="hljs-keyword">if</span> x_webhook_secret <span class="hljs-keyword">is</span> <span class="hljs-literal">None</span>:
		<span class="hljs-keyword">raise</span> HTTPException(<span class="hljs-number">401</span>)
	<span class="hljs-keyword">if</span> x_webhook_secret != WEBHOOK_SECRET:
		<span class="hljs-keyword">raise</span> HTTPException(<span class="hljs-number">403</span>)
	<span class="hljs-comment"># [...]</span>`}}),we=new _t({props:{code:"JTIzJTIwZGVmaW5lZCUyMGluJTIwc3JjJTJGbW9kZWxzLnB5JTBBY2xhc3MlMjBXZWJob29rUGF5bG9hZEV2ZW50KEJhc2VNb2RlbCklM0ElMEElMDlhY3Rpb24lM0ElMjBMaXRlcmFsJTVCJTIyY3JlYXRlJTIyJTJDJTIwJTIydXBkYXRlJTIyJTJDJTIwJTIyZGVsZXRlJTIyJTVEJTBBJTA5c2NvcGUlM0ElMjBzdHIlMEElMEFjbGFzcyUyMFdlYmhvb2tQYXlsb2FkUmVwbyhCYXNlTW9kZWwpJTNBJTBBJTA5dHlwZSUzQSUyMExpdGVyYWwlNUIlMjJkYXRhc2V0JTIyJTJDJTIwJTIybW9kZWwlMjIlMkMlMjAlMjJzcGFjZSUyMiU1RCUwQSUwOW5hbWUlM0ElMjBzdHIlMEElMDlpZCUzQSUyMHN0ciUwQSUwOXByaXZhdGUlM0ElMjBib29sJTBBJTA5aGVhZFNoYSUzQSUyMHN0ciUwQSUwQWNsYXNzJTIwV2ViaG9va1BheWxvYWQoQmFzZU1vZGVsKSUzQSUwQSUwOWV2ZW50JTNBJTIwV2ViaG9va1BheWxvYWRFdmVudCUwQSUwOXJlcG8lM0ElMjBXZWJob29rUGF5bG9hZFJlcG8lMEElMEElMjMlMjAlNUIuLi4lNUQlMEElMEElNDBhcHAucG9zdCglMjIlMkZ3ZWJob29rJTIyKSUwQWFzeW5jJTIwZGVmJTIwcG9zdF93ZWJob29rKCUwQSUwOSUyMyUyMCU1Qi4uLiU1RCUwQSUwOXBheWxvYWQlM0ElMjBXZWJob29rUGF5bG9hZCUyQyUwQSUwOSUyMyUyMCU1RSUyMFB5ZGFudGljJTIwbW9kZWwlMjBkZWZpbmluZyUyMHRoZSUyMHBheWxvYWQlMjBmb3JtYXQlMEEpJTNBJTBBJTA5JTIzJTIwJTVCLi4uJTVEJTBBJTA5aWYlMjBub3QlMjAoJTBBJTA5JTA5cGF5bG9hZC5ldmVudC5hY3Rpb24lMjAlM0QlM0QlMjAlMjJ1cGRhdGUlMjIlMEElMDklMDlhbmQlMjBwYXlsb2FkLmV2ZW50LnNjb3BlLnN0YXJ0c3dpdGgoJTIycmVwby5jb250ZW50JTIyKSUwQSUwOSUwOWFuZCUyMHBheWxvYWQucmVwby5uYW1lJTIwJTNEJTNEJTIwY29uZmlnLmlucHV0X2RhdGFzZXQlMEElMDklMDlhbmQlMjBwYXlsb2FkLnJlcG8udHlwZSUyMCUzRCUzRCUyMCUyMmRhdGFzZXQlMjIlMEElMDkpJTNBJTBBJTA5JTA5JTIzJTIwbm8tb3AlMjBpZiUyMHRoZSUyMHBheWxvYWQlMjBkb2VzJTIwbm90JTIwbWF0Y2glMjBvdXIlMjBleHBlY3RhdGlvbnMlMEElMDklMDlyZXR1cm4lMjAlN0IlMjJwcm9jZXNzZWQlMjIlM0ElMjBGYWxzZSU3RCUwQSUwOSUyMyU1Qi4uLiU1RA==",highlighted:`<span class="hljs-comment"># defined in src/models.py</span>
<span class="hljs-keyword">class</span> <span class="hljs-title class_">WebhookPayloadEvent</span>(<span class="hljs-title class_ inherited__">BaseModel</span>):
	action: <span class="hljs-type">Literal</span>[<span class="hljs-string">&quot;create&quot;</span>, <span class="hljs-string">&quot;update&quot;</span>, <span class="hljs-string">&quot;delete&quot;</span>]
	scope: <span class="hljs-built_in">str</span>

<span class="hljs-keyword">class</span> <span class="hljs-title class_">WebhookPayloadRepo</span>(<span class="hljs-title class_ inherited__">BaseModel</span>):
	<span class="hljs-built_in">type</span>: <span class="hljs-type">Literal</span>[<span class="hljs-string">&quot;dataset&quot;</span>, <span class="hljs-string">&quot;model&quot;</span>, <span class="hljs-string">&quot;space&quot;</span>]
	name: <span class="hljs-built_in">str</span>
	<span class="hljs-built_in">id</span>: <span class="hljs-built_in">str</span>
	private: <span class="hljs-built_in">bool</span>
	headSha: <span class="hljs-built_in">str</span>

<span class="hljs-keyword">class</span> <span class="hljs-title class_">WebhookPayload</span>(<span class="hljs-title class_ inherited__">BaseModel</span>):
	event: WebhookPayloadEvent
	repo: WebhookPayloadRepo

<span class="hljs-comment"># [...]</span>

<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_">post_webhook</span>(<span class="hljs-params">
	<span class="hljs-comment"># [...]</span>
	payload: WebhookPayload,
	<span class="hljs-comment"># ^ Pydantic model defining the payload format</span>
</span>):
	<span class="hljs-comment"># [...]</span>
	<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> (
		payload.event.action == <span class="hljs-string">&quot;update&quot;</span>
		<span class="hljs-keyword">and</span> payload.event.scope.startswith(<span class="hljs-string">&quot;repo.content&quot;</span>)
		<span class="hljs-keyword">and</span> payload.repo.name == config.input_dataset
		<span class="hljs-keyword">and</span> payload.repo.<span class="hljs-built_in">type</span> == <span class="hljs-string">&quot;dataset&quot;</span>
	):
		<span class="hljs-comment"># no-op if the payload does not match our expectations</span>
		<span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;processed&quot;</span>: <span class="hljs-literal">False</span>}
	<span class="hljs-comment">#[...]</span>`}}),je=new _t({props:{code:"ZGVmJTIwc2NoZWR1bGVfcmV0cmFpbihwYXlsb2FkJTNBJTIwV2ViaG9va1BheWxvYWQpJTNBJTBBJTA5JTIzJTIwQ3JlYXRlJTIwdGhlJTIwYXV0b3RyYWluJTIwcHJvamVjdCUwQSUwOXRyeSUzQSUwQSUwOSUwOXByb2plY3QlMjAlM0QlMjBBdXRvVHJhaW4uY3JlYXRlX3Byb2plY3QocGF5bG9hZCklMEElMDklMDlBdXRvVHJhaW4uYWRkX2RhdGEocHJvamVjdF9pZCUzRHByb2plY3QlNUIlMjJpZCUyMiU1RCklMEElMDklMDlBdXRvVHJhaW4uc3RhcnRfcHJvY2Vzc2luZyhwcm9qZWN0X2lkJTNEcHJvamVjdCU1QiUyMmlkJTIyJTVEKSUwQSUwOWV4Y2VwdCUyMHJlcXVlc3RzLkhUVFBFcnJvciUyMGFzJTIwZXJyJTNBJTBBJTA5JTA5cHJpbnQoJTIyRVJST1IlMjB3aGlsZSUyMHJlcXVlc3RpbmclMjBBdXRvVHJhaW4lMjBBUEklM0ElMjIpJTBBJTA5JTA5cHJpbnQoZiUyMiUyMCUyMGNvZGUlM0ElMjAlN0JlcnIucmVzcG9uc2Uuc3RhdHVzX2NvZGUlN0QlMjIpJTBBJTA5JTA5cHJpbnQoZiUyMiUyMCUyMCU3QmVyci5yZXNwb25zZS5qc29uKCklN0QlMjIpJTBBJTA5JTA5cmFpc2UlMEElMDklMjMlMjBOb3RpZnklMjBpbiUyMHRoZSUyMGNvbW11bml0eSUyMHRhYiUwQSUwOW5vdGlmeV9zdWNjZXNzKHByb2plY3QlNUIlMjJpZCUyMiU1RCk=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">schedule_retrain</span>(<span class="hljs-params">payload: WebhookPayload</span>):
	<span class="hljs-comment"># Create the autotrain project</span>
	<span class="hljs-keyword">try</span>:
		project = AutoTrain.create_project(payload)
		AutoTrain.add_data(project_id=project[<span class="hljs-string">&quot;id&quot;</span>])
		AutoTrain.start_processing(project_id=project[<span class="hljs-string">&quot;id&quot;</span>])
	<span class="hljs-keyword">except</span> requests.HTTPError <span class="hljs-keyword">as</span> err:
		<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;ERROR while requesting AutoTrain API:&quot;</span>)
		<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;  code: <span class="hljs-subst">{err.response.status_code}</span>&quot;</span>)
		<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;  <span class="hljs-subst">{err.response.json()}</span>&quot;</span>)
		<span class="hljs-keyword">raise</span>
	<span class="hljs-comment"># Notify in the community tab</span>
	notify_success(project[<span class="hljs-string">&quot;id&quot;</span>])`}}),Me=new _t({props:{code:"JTdCJTBBJTA5JTIydGFyZ2V0X25hbWVzcGFjZSUyMiUzQSUyMCUyMnRoZSUyMG5hbWVzcGFjZSUyMHdoZXJlJTIwdGhlJTIwdHJhaW5lZCUyMG1vZGVsJTIwc2hvdWxkJTIwZW5kJTIwdXAlMjIlMkMlMEElMDklMjJpbnB1dF9kYXRhc2V0JTIyJTNBJTIwJTIydGhlJTIwZGF0YXNldCUyMG9uJTIwd2hpY2glMjB0aGUlMjBtb2RlbCUyMHdpbGwlMjBiZSUyMHRyYWluZWQlMjIlMkMlMEElMDklMjJpbnB1dF9tb2RlbCUyMiUzQSUyMCUyMnRoZSUyMGJhc2UlMjBtb2RlbCUyMHRvJTIwcmUtdHJhaW4lMjIlMkMlMEElMDklMjJhdXRvdHJhaW5fcHJvamVjdF9wcmVmaXglMjIlM0ElMjAlMjJBJTIwcHJlZml4JTIwZm9yJTIwdGhlJTIwQXV0b1RyYWluJTIwcHJvamVjdCUyMiUwQSU3RA==",highlighted:`<span class="hljs-punctuation">{</span>
	<span class="hljs-attr">&quot;target_namespace&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;the namespace where the trained model should end up&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;input_dataset&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;the dataset on which the model will be trained&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;input_model&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;the base model to re-train&quot;</span><span class="hljs-punctuation">,</span>
	<span class="hljs-attr">&quot;autotrain_project_prefix&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;A prefix for the AutoTrain project&quot;</span>
<span class="hljs-punctuation">}</span>`}}),Te=new gt({}),{c(){f=a("meta"),A=h(),d=a("h1"),m=a("a"),et=a("span"),b(O.$$.fragment),Bs=h(),tt=a("span"),Ws=r("Webhook guide: Setup an automatic system to re-train a model when a dataset changes"),Bt=h(),b(R.$$.fragment),Wt=h(),Ee=a("p"),Is=r(`This guide will help walk you through the setup of an automatic training pipeline on the Hugging Face platform
using HF Datasets, Webhooks, Spaces, and AutoTrain.`),It=h(),k=a("p"),Ss=r(`We will build a Webhook that listens to changes on an image classification dataset and triggers a fine-tuning
of `),z=a("a"),As=r("microsoft/resnet-50"),Rs=r(" using "),D=a("a"),$s=r("AutoTrain"),Zs=r("."),St=h(),_=a("h2"),$=a("a"),st=a("span"),b(x.$$.fragment),Vs=h(),at=a("span"),Cs=r("Prerequisite: Upload your dataset to the Hub"),At=h(),E=a("p"),Gs=r("We will use a "),K=a("a"),Hs=r("simple image classification dataset"),Ns=r(` for the sake
of the example. Learn more about uploading your data to the Hub `),ee=a("a"),qs=r("here"),Qs=r("."),Rt=h(),ge=a("p"),_e=a("img"),$t=h(),U=a("h2"),Z=a("a"),lt=a("span"),b(te.$$.fragment),Ys=h(),ot=a("span"),Ps=r("Create a Webhook to react to the dataset's changes"),Zt=h(),V=a("p"),Xs=r("First, let\u2019s create a Webhook from your "),se=a("a"),Fs=r("settings"),Ls=r("."),Vt=h(),w=a("ul"),ae=a("li"),Os=r("Select your dataset as the target repository. We will target "),le=a("a"),zs=r("huggingface-projects/input-dataset"),Ds=r(" in this example."),xs=h(),nt=a("li"),Ks=r("You can put a dummy Webhook URL for now. Defining your Webhook will let you look at the events that will be sent to it. You can also replay them, which will be useful for debugging!"),ea=h(),rt=a("li"),ta=r("Input a secret to make it more secure."),sa=h(),it=a("li"),aa=r("Subscribe to \u201CRepo update\u201D events as we want to react to data changes"),Ct=h(),Ue=a("p"),la=r("Your Webhook will look like this:"),Gt=h(),Be=a("p"),We=a("img"),Ht=h(),B=a("h2"),C=a("a"),pt=a("span"),b(oe.$$.fragment),oa=h(),ct=a("span"),na=r("Create a Space to react to your Webhook"),Nt=h(),G=a("p"),ra=r("We now need a way to react to your Webhook events. An easy way to do this is to use a "),ne=a("a"),ia=r("Space"),pa=r("!"),qt=h(),H=a("p"),ca=r("You can find an example Space "),re=a("a"),ha=r("here"),ua=r("."),Qt=h(),y=a("p"),fa=r("This Space uses Docker, Python, "),ie=a("a"),da=r("FastAPI"),ma=r(", and "),pe=a("a"),wa=r("uvicorn"),ya=r(" to run a simple HTTP server. Read more about Docker Spaces "),ce=a("a"),ba=r("here"),ja=r("."),Yt=h(),N=a("p"),va=r("The entry point is "),he=a("a"),Ma=r("src/main.py"),Ta=r(". Let\u2019s walk through this file and detail what it does:"),Pt=h(),Ie=a("ol"),W=a("li"),Ja=r("It spawns a FastAPI app that will listen to HTTP "),ht=a("code"),ka=r("POST"),Ea=r(" requests on "),ut=a("code"),ga=r("/webhook"),_a=r(":"),Xt=h(),b(ue.$$.fragment),Ft=h(),fe=a("ol"),ft=a("li"),Se=a("ol"),I=a("li"),Ua=r("This route checks that the "),dt=a("code"),Ba=r("X-Webhook-Secret"),Wa=r(" header is present and that its value is the same as the one you set in your Webhook\u2019s settings. The "),mt=a("code"),Ia=r("WEBHOOK_SECRET"),Sa=r(" secret must be set in the Space\u2019s settings and be the same as the secret set in your Webhook."),Lt=h(),b(de.$$.fragment),Ot=h(),me=a("ol"),wt=a("li"),Aa=r("The event\u2019s payload is encoded as JSON. Here, we\u2019ll be using pydantic models to parse the event payload. We also specify that we will run our Webhook only when:"),zt=h(),q=a("ul"),yt=a("li"),Ra=r("the event concerns the input dataset"),$a=h(),bt=a("li"),Za=r("the event is an update on the repo\u2019s content, i.e., there has been a new commit"),Dt=h(),b(we.$$.fragment),xt=h(),ye=a("ol"),be=a("li"),Va=r("If the payload is valid, the next step is to create a project on AutoTrain, schedule a fine-tuning of the input model ("),jt=a("code"),Ca=r("microsoft/resnet-50"),Ga=r(" in our example) on the input dataset, and create a discussion on the dataset when it\u2019s done!"),Kt=h(),b(je.$$.fragment),es=h(),Ae=a("p"),Ha=r("Visit the link inside the comment to review the training cost estimate, and start fine-tuning the model!"),ts=h(),Re=a("p"),$e=a("img"),ss=h(),Ze=a("p"),Na=r("In this example, we used Hugging Face AutoTrain to fine-tune our model quickly, but you can of course plug in your training infrastructure!"),as=h(),Ve=a("p"),qa=r("Feel free to duplicate the Space to your personal namespace and play with it. You will need to provide two secrets:"),ls=h(),Q=a("ul"),Ce=a("li"),vt=a("code"),Qa=r("WEBHOOK_SECRET"),Ya=r(" : the secret from your Webhook."),Pa=h(),g=a("li"),Mt=a("code"),Xa=r("HF_ACCESS_TOKEN"),Fa=r(" : a User Access Token with "),Tt=a("code"),La=r("write"),Oa=r(" rights. You can create one "),ve=a("a"),za=r("from your settings"),Da=r("."),os=h(),Y=a("p"),xa=r("You will also need to tweak the "),P=a("a"),Jt=a("code"),Ka=r("config.json"),el=r(" file"),tl=r(" to use the dataset and model of you choice:"),ns=h(),b(Me.$$.fragment),rs=h(),S=a("h2"),X=a("a"),kt=a("span"),b(Te.$$.fragment),sl=h(),Et=a("span"),al=r("Configure your Webhook to send events to your Space"),is=h(),Ge=a("p"),ll=r("Last but not least, you\u2019ll need to configure your webhook to send POST requests to your Space."),ps=h(),He=a("p"),ol=r("Let\u2019s first grab our Space\u2019s \u201Cdirect URL\u201D from the contextual menu. Click on \u201CEmbed this Space\u201D and copy the \u201CDirect URL\u201D."),cs=h(),Ne=a("p"),qe=a("img"),hs=h(),Qe=a("p"),Ye=a("img"),us=h(),Pe=a("p"),nl=r("Update your Webhook to send requests to that URL:"),fs=h(),Xe=a("p"),Fe=a("img"),ds=h(),Le=a("p"),rl=r("And that\u2019s it! Now every commit to the input dataset will trigger a fine-tuning of ResNet-50 with AutoTrain \u{1F389}"),this.h()},l(e){const o=Wo('[data-svelte="svelte-1phssyn"]',document.head);f=l(o,"META",{name:!0,content:!0}),o.forEach(t),A=u(e),d=l(e,"H1",{class:!0});var Je=n(d);m=l(Je,"A",{id:!0,class:!0,href:!0});var wl=n(m);et=l(wl,"SPAN",{});var yl=n(et);j(O.$$.fragment,yl),yl.forEach(t),wl.forEach(t),Bs=u(Je),tt=l(Je,"SPAN",{});var bl=n(tt);Ws=i(bl,"Webhook guide: Setup an automatic system to re-train a model when a dataset changes"),bl.forEach(t),Je.forEach(t),Bt=u(e),j(R.$$.fragment,e),Wt=u(e),Ee=l(e,"P",{});var jl=n(Ee);Is=i(jl,`This guide will help walk you through the setup of an automatic training pipeline on the Hugging Face platform
using HF Datasets, Webhooks, Spaces, and AutoTrain.`),jl.forEach(t),It=u(e),k=l(e,"P",{});var Oe=n(k);Ss=i(Oe,`We will build a Webhook that listens to changes on an image classification dataset and triggers a fine-tuning
of `),z=l(Oe,"A",{href:!0,rel:!0});var vl=n(z);As=i(vl,"microsoft/resnet-50"),vl.forEach(t),Rs=i(Oe," using "),D=l(Oe,"A",{href:!0,rel:!0});var Ml=n(D);$s=i(Ml,"AutoTrain"),Ml.forEach(t),Zs=i(Oe,"."),Oe.forEach(t),St=u(e),_=l(e,"H2",{class:!0});var ws=n(_);$=l(ws,"A",{id:!0,class:!0,href:!0});var Tl=n($);st=l(Tl,"SPAN",{});var Jl=n(st);j(x.$$.fragment,Jl),Jl.forEach(t),Tl.forEach(t),Vs=u(ws),at=l(ws,"SPAN",{});var kl=n(at);Cs=i(kl,"Prerequisite: Upload your dataset to the Hub"),kl.forEach(t),ws.forEach(t),At=u(e),E=l(e,"P",{});var ze=n(E);Gs=i(ze,"We will use a "),K=l(ze,"A",{href:!0,rel:!0});var El=n(K);Hs=i(El,"simple image classification dataset"),El.forEach(t),Ns=i(ze,` for the sake
of the example. Learn more about uploading your data to the Hub `),ee=l(ze,"A",{href:!0,rel:!0});var gl=n(ee);qs=i(gl,"here"),gl.forEach(t),Qs=i(ze,"."),ze.forEach(t),Rt=u(e),ge=l(e,"P",{});var _l=n(ge);_e=l(_l,"IMG",{src:!0,alt:!0}),_l.forEach(t),$t=u(e),U=l(e,"H2",{class:!0});var ys=n(U);Z=l(ys,"A",{id:!0,class:!0,href:!0});var Ul=n(Z);lt=l(Ul,"SPAN",{});var Bl=n(lt);j(te.$$.fragment,Bl),Bl.forEach(t),Ul.forEach(t),Ys=u(ys),ot=l(ys,"SPAN",{});var Wl=n(ot);Ps=i(Wl,"Create a Webhook to react to the dataset's changes"),Wl.forEach(t),ys.forEach(t),Zt=u(e),V=l(e,"P",{});var bs=n(V);Xs=i(bs,"First, let\u2019s create a Webhook from your "),se=l(bs,"A",{href:!0,rel:!0});var Il=n(se);Fs=i(Il,"settings"),Il.forEach(t),Ls=i(bs,"."),bs.forEach(t),Vt=u(e),w=l(e,"UL",{});var F=n(w);ae=l(F,"LI",{});var js=n(ae);Os=i(js,"Select your dataset as the target repository. We will target "),le=l(js,"A",{href:!0,rel:!0});var Sl=n(le);zs=i(Sl,"huggingface-projects/input-dataset"),Sl.forEach(t),Ds=i(js," in this example."),js.forEach(t),xs=u(F),nt=l(F,"LI",{});var Al=n(nt);Ks=i(Al,"You can put a dummy Webhook URL for now. Defining your Webhook will let you look at the events that will be sent to it. You can also replay them, which will be useful for debugging!"),Al.forEach(t),ea=u(F),rt=l(F,"LI",{});var Rl=n(rt);ta=i(Rl,"Input a secret to make it more secure."),Rl.forEach(t),sa=u(F),it=l(F,"LI",{});var $l=n(it);aa=i($l,"Subscribe to \u201CRepo update\u201D events as we want to react to data changes"),$l.forEach(t),F.forEach(t),Ct=u(e),Ue=l(e,"P",{});var Zl=n(Ue);la=i(Zl,"Your Webhook will look like this:"),Zl.forEach(t),Gt=u(e),Be=l(e,"P",{});var Vl=n(Be);We=l(Vl,"IMG",{src:!0,alt:!0}),Vl.forEach(t),Ht=u(e),B=l(e,"H2",{class:!0});var vs=n(B);C=l(vs,"A",{id:!0,class:!0,href:!0});var Cl=n(C);pt=l(Cl,"SPAN",{});var Gl=n(pt);j(oe.$$.fragment,Gl),Gl.forEach(t),Cl.forEach(t),oa=u(vs),ct=l(vs,"SPAN",{});var Hl=n(ct);na=i(Hl,"Create a Space to react to your Webhook"),Hl.forEach(t),vs.forEach(t),Nt=u(e),G=l(e,"P",{});var Ms=n(G);ra=i(Ms,"We now need a way to react to your Webhook events. An easy way to do this is to use a "),ne=l(Ms,"A",{href:!0,rel:!0});var Nl=n(ne);ia=i(Nl,"Space"),Nl.forEach(t),pa=i(Ms,"!"),Ms.forEach(t),qt=u(e),H=l(e,"P",{});var Ts=n(H);ca=i(Ts,"You can find an example Space "),re=l(Ts,"A",{href:!0,rel:!0});var ql=n(re);ha=i(ql,"here"),ql.forEach(t),ua=i(Ts,"."),Ts.forEach(t),Qt=u(e),y=l(e,"P",{});var L=n(y);fa=i(L,"This Space uses Docker, Python, "),ie=l(L,"A",{href:!0,rel:!0});var Ql=n(ie);da=i(Ql,"FastAPI"),Ql.forEach(t),ma=i(L,", and "),pe=l(L,"A",{href:!0,rel:!0});var Yl=n(pe);wa=i(Yl,"uvicorn"),Yl.forEach(t),ya=i(L," to run a simple HTTP server. Read more about Docker Spaces "),ce=l(L,"A",{href:!0,rel:!0});var Pl=n(ce);ba=i(Pl,"here"),Pl.forEach(t),ja=i(L,"."),L.forEach(t),Yt=u(e),N=l(e,"P",{});var Js=n(N);va=i(Js,"The entry point is "),he=l(Js,"A",{href:!0,rel:!0});var Xl=n(he);Ma=i(Xl,"src/main.py"),Xl.forEach(t),Ta=i(Js,". Let\u2019s walk through this file and detail what it does:"),Js.forEach(t),Pt=u(e),Ie=l(e,"OL",{});var Fl=n(Ie);W=l(Fl,"LI",{});var De=n(W);Ja=i(De,"It spawns a FastAPI app that will listen to HTTP "),ht=l(De,"CODE",{});var Ll=n(ht);ka=i(Ll,"POST"),Ll.forEach(t),Ea=i(De," requests on "),ut=l(De,"CODE",{});var Ol=n(ut);ga=i(Ol,"/webhook"),Ol.forEach(t),_a=i(De,":"),De.forEach(t),Fl.forEach(t),Xt=u(e),j(ue.$$.fragment,e),Ft=u(e),fe=l(e,"OL",{start:!0});var zl=n(fe);ft=l(zl,"LI",{});var Dl=n(ft);Se=l(Dl,"OL",{start:!0});var xl=n(Se);I=l(xl,"LI",{});var xe=n(I);Ua=i(xe,"This route checks that the "),dt=l(xe,"CODE",{});var Kl=n(dt);Ba=i(Kl,"X-Webhook-Secret"),Kl.forEach(t),Wa=i(xe," header is present and that its value is the same as the one you set in your Webhook\u2019s settings. The "),mt=l(xe,"CODE",{});var eo=n(mt);Ia=i(eo,"WEBHOOK_SECRET"),eo.forEach(t),Sa=i(xe," secret must be set in the Space\u2019s settings and be the same as the secret set in your Webhook."),xe.forEach(t),xl.forEach(t),Dl.forEach(t),zl.forEach(t),Lt=u(e),j(de.$$.fragment,e),Ot=u(e),me=l(e,"OL",{start:!0});var to=n(me);wt=l(to,"LI",{});var so=n(wt);Aa=i(so,"The event\u2019s payload is encoded as JSON. Here, we\u2019ll be using pydantic models to parse the event payload. We also specify that we will run our Webhook only when:"),so.forEach(t),to.forEach(t),zt=u(e),q=l(e,"UL",{});var ks=n(q);yt=l(ks,"LI",{});var ao=n(yt);Ra=i(ao,"the event concerns the input dataset"),ao.forEach(t),$a=u(ks),bt=l(ks,"LI",{});var lo=n(bt);Za=i(lo,"the event is an update on the repo\u2019s content, i.e., there has been a new commit"),lo.forEach(t),ks.forEach(t),Dt=u(e),j(we.$$.fragment,e),xt=u(e),ye=l(e,"OL",{start:!0});var oo=n(ye);be=l(oo,"LI",{});var Es=n(be);Va=i(Es,"If the payload is valid, the next step is to create a project on AutoTrain, schedule a fine-tuning of the input model ("),jt=l(Es,"CODE",{});var no=n(jt);Ca=i(no,"microsoft/resnet-50"),no.forEach(t),Ga=i(Es," in our example) on the input dataset, and create a discussion on the dataset when it\u2019s done!"),Es.forEach(t),oo.forEach(t),Kt=u(e),j(je.$$.fragment,e),es=u(e),Ae=l(e,"P",{});var ro=n(Ae);Ha=i(ro,"Visit the link inside the comment to review the training cost estimate, and start fine-tuning the model!"),ro.forEach(t),ts=u(e),Re=l(e,"P",{});var io=n(Re);$e=l(io,"IMG",{src:!0,alt:!0}),io.forEach(t),ss=u(e),Ze=l(e,"P",{});var po=n(Ze);Na=i(po,"In this example, we used Hugging Face AutoTrain to fine-tune our model quickly, but you can of course plug in your training infrastructure!"),po.forEach(t),as=u(e),Ve=l(e,"P",{});var co=n(Ve);qa=i(co,"Feel free to duplicate the Space to your personal namespace and play with it. You will need to provide two secrets:"),co.forEach(t),ls=u(e),Q=l(e,"UL",{});var gs=n(Q);Ce=l(gs,"LI",{});var il=n(Ce);vt=l(il,"CODE",{});var ho=n(vt);Qa=i(ho,"WEBHOOK_SECRET"),ho.forEach(t),Ya=i(il," : the secret from your Webhook."),il.forEach(t),Pa=u(gs),g=l(gs,"LI",{});var ke=n(g);Mt=l(ke,"CODE",{});var uo=n(Mt);Xa=i(uo,"HF_ACCESS_TOKEN"),uo.forEach(t),Fa=i(ke," : a User Access Token with "),Tt=l(ke,"CODE",{});var fo=n(Tt);La=i(fo,"write"),fo.forEach(t),Oa=i(ke," rights. You can create one "),ve=l(ke,"A",{href:!0,rel:!0});var mo=n(ve);za=i(mo,"from your settings"),mo.forEach(t),Da=i(ke,"."),ke.forEach(t),gs.forEach(t),os=u(e),Y=l(e,"P",{});var _s=n(Y);xa=i(_s,"You will also need to tweak the "),P=l(_s,"A",{href:!0,rel:!0});var pl=n(P);Jt=l(pl,"CODE",{});var wo=n(Jt);Ka=i(wo,"config.json"),wo.forEach(t),el=i(pl," file"),pl.forEach(t),tl=i(_s," to use the dataset and model of you choice:"),_s.forEach(t),ns=u(e),j(Me.$$.fragment,e),rs=u(e),S=l(e,"H2",{class:!0});var Us=n(S);X=l(Us,"A",{id:!0,class:!0,href:!0});var yo=n(X);kt=l(yo,"SPAN",{});var bo=n(kt);j(Te.$$.fragment,bo),bo.forEach(t),yo.forEach(t),sl=u(Us),Et=l(Us,"SPAN",{});var jo=n(Et);al=i(jo,"Configure your Webhook to send events to your Space"),jo.forEach(t),Us.forEach(t),is=u(e),Ge=l(e,"P",{});var vo=n(Ge);ll=i(vo,"Last but not least, you\u2019ll need to configure your webhook to send POST requests to your Space."),vo.forEach(t),ps=u(e),He=l(e,"P",{});var Mo=n(He);ol=i(Mo,"Let\u2019s first grab our Space\u2019s \u201Cdirect URL\u201D from the contextual menu. Click on \u201CEmbed this Space\u201D and copy the \u201CDirect URL\u201D."),Mo.forEach(t),cs=u(e),Ne=l(e,"P",{});var To=n(Ne);qe=l(To,"IMG",{src:!0,alt:!0}),To.forEach(t),hs=u(e),Qe=l(e,"P",{});var Jo=n(Qe);Ye=l(Jo,"IMG",{src:!0,alt:!0}),Jo.forEach(t),us=u(e),Pe=l(e,"P",{});var ko=n(Pe);nl=i(ko,"Update your Webhook to send requests to that URL:"),ko.forEach(t),fs=u(e),Xe=l(e,"P",{});var Eo=n(Xe);Fe=l(Eo,"IMG",{src:!0,alt:!0}),Eo.forEach(t),ds=u(e),Le=l(e,"P",{});var go=n(Le);rl=i(go,"And that\u2019s it! Now every commit to the input dataset will trigger a fine-tuning of ResNet-50 with AutoTrain \u{1F389}"),go.forEach(t),this.h()},h(){c(f,"name","hf:doc:metadata"),c(f,"content",JSON.stringify($o)),c(m,"id","webhook-guide-setup-an-automatic-system-to-retrain-a-model-when-a-dataset-changes"),c(m,"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"),c(m,"href","#webhook-guide-setup-an-automatic-system-to-retrain-a-model-when-a-dataset-changes"),c(d,"class","relative group"),c(z,"href","https://huggingface.co/microsoft/resnet-50"),c(z,"rel","nofollow"),c(D,"href","https://huggingface.co/autotrain"),c(D,"rel","nofollow"),c($,"id","prerequisite-upload-your-dataset-to-the-hub"),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"),c($,"href","#prerequisite-upload-your-dataset-to-the-hub"),c(_,"class","relative group"),c(K,"href","https://huggingface.co/datasets/huggingface-projects/auto-retrain-input-dataset"),c(K,"rel","nofollow"),c(ee,"href","https://huggingface.co/docs/datasets/upload_dataset"),c(ee,"rel","nofollow"),Ke(_e.src,cl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/002-auto-retrain/dataset.png")||c(_e,"src",cl),c(_e,"alt","dataset"),c(Z,"id","create-a-webhook-to-react-to-the-datasets-changes"),c(Z,"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"),c(Z,"href","#create-a-webhook-to-react-to-the-datasets-changes"),c(U,"class","relative group"),c(se,"href","https://huggingface.co/settings/webhooks"),c(se,"rel","nofollow"),c(le,"href","https://huggingface.co/datasets/huggingface-projects/input-dataset"),c(le,"rel","nofollow"),Ke(We.src,hl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/002-auto-retrain/webhook-creation.png")||c(We,"src",hl),c(We,"alt","webhook-creation"),c(C,"id","create-a-space-to-react-to-your-webhook"),c(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"),c(C,"href","#create-a-space-to-react-to-your-webhook"),c(B,"class","relative group"),c(ne,"href","https://huggingface.co/docs/hub/spaces-overview"),c(ne,"rel","nofollow"),c(re,"href","https://huggingface.co/spaces/huggingface-projects/auto-retrain/tree/main"),c(re,"rel","nofollow"),c(ie,"href","https://fastapi.tiangolo.com/"),c(ie,"rel","nofollow"),c(pe,"href","https://www.uvicorn.org"),c(pe,"rel","nofollow"),c(ce,"href","https://huggingface.co/docs/hub/spaces-sdks-docker"),c(ce,"rel","nofollow"),c(he,"href","https://huggingface.co/spaces/huggingface-projects/auto-retrain/blob/main/src/main.py"),c(he,"rel","nofollow"),c(Se,"start","2"),c(fe,"start","2"),c(me,"start","3"),c(ye,"start","4"),Ke($e.src,ul="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/002-auto-retrain/notification.png")||c($e,"src",ul),c($e,"alt","community tab notification"),c(ve,"href","https://huggingface.co/settings/tokens"),c(ve,"rel","nofollow"),c(P,"href","https://huggingface.co/spaces/huggingface-projects/auto-retrain/blob/main/config.json"),c(P,"rel","nofollow"),c(X,"id","configure-your-webhook-to-send-events-to-your-space"),c(X,"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"),c(X,"href","#configure-your-webhook-to-send-events-to-your-space"),c(S,"class","relative group"),Ke(qe.src,fl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/002-auto-retrain/duplicate-space.png")||c(qe,"src",fl),c(qe,"alt","embed this Space"),Ke(Ye.src,dl="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/002-auto-retrain/direct-url.png")||c(Ye,"src",dl),c(Ye,"alt","direct URL"),Ke(Fe.src,ml="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/webhooks-guides/002-auto-retrain/update-webhook.png")||c(Fe,"src",ml),c(Fe,"alt","webhook settings")},m(e,o){s(document.head,f),p(e,A,o),p(e,d,o),s(d,m),s(m,et),v(O,et,null),s(d,Bs),s(d,tt),s(tt,Ws),p(e,Bt,o),v(R,e,o),p(e,Wt,o),p(e,Ee,o),s(Ee,Is),p(e,It,o),p(e,k,o),s(k,Ss),s(k,z),s(z,As),s(k,Rs),s(k,D),s(D,$s),s(k,Zs),p(e,St,o),p(e,_,o),s(_,$),s($,st),v(x,st,null),s(_,Vs),s(_,at),s(at,Cs),p(e,At,o),p(e,E,o),s(E,Gs),s(E,K),s(K,Hs),s(E,Ns),s(E,ee),s(ee,qs),s(E,Qs),p(e,Rt,o),p(e,ge,o),s(ge,_e),p(e,$t,o),p(e,U,o),s(U,Z),s(Z,lt),v(te,lt,null),s(U,Ys),s(U,ot),s(ot,Ps),p(e,Zt,o),p(e,V,o),s(V,Xs),s(V,se),s(se,Fs),s(V,Ls),p(e,Vt,o),p(e,w,o),s(w,ae),s(ae,Os),s(ae,le),s(le,zs),s(ae,Ds),s(w,xs),s(w,nt),s(nt,Ks),s(w,ea),s(w,rt),s(rt,ta),s(w,sa),s(w,it),s(it,aa),p(e,Ct,o),p(e,Ue,o),s(Ue,la),p(e,Gt,o),p(e,Be,o),s(Be,We),p(e,Ht,o),p(e,B,o),s(B,C),s(C,pt),v(oe,pt,null),s(B,oa),s(B,ct),s(ct,na),p(e,Nt,o),p(e,G,o),s(G,ra),s(G,ne),s(ne,ia),s(G,pa),p(e,qt,o),p(e,H,o),s(H,ca),s(H,re),s(re,ha),s(H,ua),p(e,Qt,o),p(e,y,o),s(y,fa),s(y,ie),s(ie,da),s(y,ma),s(y,pe),s(pe,wa),s(y,ya),s(y,ce),s(ce,ba),s(y,ja),p(e,Yt,o),p(e,N,o),s(N,va),s(N,he),s(he,Ma),s(N,Ta),p(e,Pt,o),p(e,Ie,o),s(Ie,W),s(W,Ja),s(W,ht),s(ht,ka),s(W,Ea),s(W,ut),s(ut,ga),s(W,_a),p(e,Xt,o),v(ue,e,o),p(e,Ft,o),p(e,fe,o),s(fe,ft),s(ft,Se),s(Se,I),s(I,Ua),s(I,dt),s(dt,Ba),s(I,Wa),s(I,mt),s(mt,Ia),s(I,Sa),p(e,Lt,o),v(de,e,o),p(e,Ot,o),p(e,me,o),s(me,wt),s(wt,Aa),p(e,zt,o),p(e,q,o),s(q,yt),s(yt,Ra),s(q,$a),s(q,bt),s(bt,Za),p(e,Dt,o),v(we,e,o),p(e,xt,o),p(e,ye,o),s(ye,be),s(be,Va),s(be,jt),s(jt,Ca),s(be,Ga),p(e,Kt,o),v(je,e,o),p(e,es,o),p(e,Ae,o),s(Ae,Ha),p(e,ts,o),p(e,Re,o),s(Re,$e),p(e,ss,o),p(e,Ze,o),s(Ze,Na),p(e,as,o),p(e,Ve,o),s(Ve,qa),p(e,ls,o),p(e,Q,o),s(Q,Ce),s(Ce,vt),s(vt,Qa),s(Ce,Ya),s(Q,Pa),s(Q,g),s(g,Mt),s(Mt,Xa),s(g,Fa),s(g,Tt),s(Tt,La),s(g,Oa),s(g,ve),s(ve,za),s(g,Da),p(e,os,o),p(e,Y,o),s(Y,xa),s(Y,P),s(P,Jt),s(Jt,Ka),s(P,el),s(Y,tl),p(e,ns,o),v(Me,e,o),p(e,rs,o),p(e,S,o),s(S,X),s(X,kt),v(Te,kt,null),s(S,sl),s(S,Et),s(Et,al),p(e,is,o),p(e,Ge,o),s(Ge,ll),p(e,ps,o),p(e,He,o),s(He,ol),p(e,cs,o),p(e,Ne,o),s(Ne,qe),p(e,hs,o),p(e,Qe,o),s(Qe,Ye),p(e,us,o),p(e,Pe,o),s(Pe,nl),p(e,fs,o),p(e,Xe,o),s(Xe,Fe),p(e,ds,o),p(e,Le,o),s(Le,rl),ms=!0},p(e,[o]){const Je={};o&2&&(Je.$$scope={dirty:o,ctx:e}),R.$set(Je)},i(e){ms||(M(O.$$.fragment,e),M(R.$$.fragment,e),M(x.$$.fragment,e),M(te.$$.fragment,e),M(oe.$$.fragment,e),M(ue.$$.fragment,e),M(de.$$.fragment,e),M(we.$$.fragment,e),M(je.$$.fragment,e),M(Me.$$.fragment,e),M(Te.$$.fragment,e),ms=!0)},o(e){T(O.$$.fragment,e),T(R.$$.fragment,e),T(x.$$.fragment,e),T(te.$$.fragment,e),T(oe.$$.fragment,e),T(ue.$$.fragment,e),T(de.$$.fragment,e),T(we.$$.fragment,e),T(je.$$.fragment,e),T(Me.$$.fragment,e),T(Te.$$.fragment,e),ms=!1},d(e){t(f),e&&t(A),e&&t(d),J(O),e&&t(Bt),J(R,e),e&&t(Wt),e&&t(Ee),e&&t(It),e&&t(k),e&&t(St),e&&t(_),J(x),e&&t(At),e&&t(E),e&&t(Rt),e&&t(ge),e&&t($t),e&&t(U),J(te),e&&t(Zt),e&&t(V),e&&t(Vt),e&&t(w),e&&t(Ct),e&&t(Ue),e&&t(Gt),e&&t(Be),e&&t(Ht),e&&t(B),J(oe),e&&t(Nt),e&&t(G),e&&t(qt),e&&t(H),e&&t(Qt),e&&t(y),e&&t(Yt),e&&t(N),e&&t(Pt),e&&t(Ie),e&&t(Xt),J(ue,e),e&&t(Ft),e&&t(fe),e&&t(Lt),J(de,e),e&&t(Ot),e&&t(me),e&&t(zt),e&&t(q),e&&t(Dt),J(we,e),e&&t(xt),e&&t(ye),e&&t(Kt),J(je,e),e&&t(es),e&&t(Ae),e&&t(ts),e&&t(Re),e&&t(ss),e&&t(Ze),e&&t(as),e&&t(Ve),e&&t(ls),e&&t(Q),e&&t(os),e&&t(Y),e&&t(ns),J(Me,e),e&&t(rs),e&&t(S),J(Te),e&&t(is),e&&t(Ge),e&&t(ps),e&&t(He),e&&t(cs),e&&t(Ne),e&&t(hs),e&&t(Qe),e&&t(us),e&&t(Pe),e&&t(fs),e&&t(Xe),e&&t(ds),e&&t(Le)}}}const $o={local:"webhook-guide-setup-an-automatic-system-to-retrain-a-model-when-a-dataset-changes",sections:[{local:"prerequisite-upload-your-dataset-to-the-hub",title:"Prerequisite: Upload your dataset to the Hub"},{local:"create-a-webhook-to-react-to-the-datasets-changes",title:"Create a Webhook to react to the dataset's changes"},{local:"create-a-space-to-react-to-your-webhook",title:"Create a Space to react to your Webhook"},{local:"configure-your-webhook-to-send-events-to-your-space",title:"Configure your Webhook to send events to your Space"}],title:"Webhook guide: Setup an automatic system to re-train a model when a dataset changes"};function Zo(Ut){return Io(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class No extends _o{constructor(f){super();Uo(this,f,Zo,Ro,Bo,{})}}export{No as default,$o as metadata};
