import{s as Se,n as Ye,o as Ne}from"../chunks/scheduler.d6170356.js";import{S as Re,i as Xe,g as i,s as o,r as c,A as Ee,h as l,f as a,c as n,j as ze,u,x as d,k as R,y as Ve,a as s,v as h,d as p,t as m,w as f}from"../chunks/index.fcd4cc08.js";import{C as we}from"../chunks/CodeBlock.7b16bdef.js";import{H as X}from"../chunks/Heading.8660bd0e.js";function Ae(Te){let r,E,Y,V,y,A,$,Me=`To give model creators more control over how their models are used, the Hub allows users to enable <strong>User Access requests</strong> through a model’s <strong>Settings</strong> tab.
Enabling this setting requires users to agree to share their contact information and accept the model owners’ terms and conditions in order to access the model.
The contact information is stored in a database, and model owners are able to download a copy of the user access report.`,Q,w,_e='Note that to download a gated model you’ll need to be authenticated. You can log in by installing the <a href="https://huggingface.co/docs/huggingface_hub/index" rel="nofollow"><code>huggingface_hub</code> client library</a> and running the following in your terminal:',F,T,D,M,qe="If you’re using a Jupyter or Colaboratory notebook, log in with the following Python command",O,_,K,q,xe="Then, ensure that your library uses the token. This is now the case by default in huggingface-maintained libraries.",ee,x,ke='However, on older versions of libraries, for example if using 🤗 Transformers with a version of <code>huggingface_hub</code> older than <code>v0.10</code> <a href="https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained" rel="nofollow">you’ll need to pass <code>use_auth_token=True</code></a> when calling <code>.from_pretrained()</code>.',te,k,ae,j,je="The User Access request dialog can be modified to include additional text and checkbox fields in the prompt. To do this, add a YAML section to the model’s <code>README.md</code> file (create one if it does not already exist) and add an <code>extra_gated_fields</code> property. Within this property, you’ll be able to add as many custom fields as you like and whether they are a <code>text</code> or <code>checkbox</code> field. An <code>extra_gated_prompt</code> property can also be included to add a customized text message.",se,H,oe,g,He='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-dark.png"/>',ne,C,Ce='The <code>README.md</code> file for a model is called a <a href="./model-cards">model Card</a>. Visit the documentation to learn more about how to use it and to see the properties that you can configure.',ie,J,le,U,Je=`By default, requests to access the model are automatically accepted.
Model authors can set the approval mode to “Manual reviews” from the model’s <strong>Settings</strong> tab.
Doing so enforces that each access request will be manually reviewed and approved by the model authors.
Only users whose access requests have been approved will be able to access the model’s content.`,de,b,Ue='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-manual-approval.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-manual-approval-dark.png"/>',re,B,Be="You can automate the approval of access requests with the following API:",ce,Z,Ze="<thead><tr><th>Method</th> <th>URI</th> <th>Description</th> <th>Payload</th></tr></thead> <tbody><tr><td><code>GET</code></td> <td><code>/api/models/{repo_id}/user-access-request/pending</code></td> <td>Retrieve the list of pending access requests for the given model.</td> <td><code>headers = { &quot;authorization&quot; : &quot;Bearer $token&quot; }</code></td></tr> <tr><td><code>GET</code></td> <td><code>/api/models/{repo_id}/user-access-request/accepted</code></td> <td>Retrieve the list of accepted access requests for the given model.</td> <td><code>headers = { &quot;authorization&quot; : &quot;Bearer $token&quot; }</code></td></tr> <tr><td><code>GET</code></td> <td><code>/api/models/{repo_id}/user-access-request/rejected</code></td> <td>Retrieve the list of rejected access requests for the given model</td> <td><code>headers = { &quot;authorization&quot; : &quot;Bearer $token&quot; }</code></td></tr> <tr><td><code>POST</code></td> <td><code>/api/models/{repo_id}/user-access-request/handle</code></td> <td>Change the status of a given access request to <code>status</code>.</td> <td><code>headers = { &quot;authorization&quot; : &quot;Bearer $token&quot; }</code> <code>json = { &quot;status&quot;: &quot;accepted&quot; | &quot;rejected&quot; | &quot;pending&quot;, &quot;user&quot;: &quot;username&quot; }</code></td></tr> <tr><td><code>POST</code></td> <td><code>/api/models/{repo_id}/user-access-request/grant</code></td> <td>Allow a specific user to access your repo.</td> <td><code>headers = { &quot;authorization&quot; : &quot;Bearer $token&quot; }</code> <code>json = { &quot;user&quot;: &quot;username&quot; }</code></td></tr></tbody>",ue,L,Le='The base URL for the HTTP endpoints above is <code>https://huggingface.co</code>. The <code>$token</code> to pass as a bearer token can be generated from <a href="https://huggingface.co/settings/tokens" rel="nofollow">your user settings</a>. It must have <code>write</code> access to the gated repository.',he,G,pe,I,Ge=`By default, notifications for new pending access requests are sent once a day via email.
When the repo lives in an organization, those emails are sent to the first 5 admins of the organization.`,me,W,Ie=`You can customize the way you receive those notifications from the gated model’s settings page.
You can choose whether to receive notifications for new pending access requests in bulk once a day or in real-time.
You can also set a custom email to send those notifications to.`,fe,v,We='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-notifications.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-notifications-dark.png"/>',ge,P,be,z,Pe="In some cases, you might also want to modify the text in the heading of the gate as well as the text in the button. For those use cases you can modify <code>extra_gated_heading</code> and <code>extra_gated_button_content</code>.",ve,S,ye,N,$e;return y=new X({props:{title:"Gated models",local:"gated-models",headingTag:"h1"}}),T=new we({props:{code:"aHVnZ2luZ2ZhY2UtY2xpJTIwbG9naW4=",highlighted:"huggingface-cli login",wrap:!1}}),_=new we({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login
notebook_login()`,wrap:!1}}),k=new X({props:{title:"Modifying the prompt",local:"modifying-the-prompt",headingTag:"h2"}}),H=new we({props:{code:"LS0tJTBBZXh0cmFfZ2F0ZWRfcHJvbXB0JTNBJTIwJTIyWW91JTIwYWdyZWUlMjB0byUyMG5vdCUyMHVzZSUyMHRoZSUyMG1vZGVsJTIwdG8lMjBjb25kdWN0JTIwZXhwZXJpbWVudHMlMjB0aGF0JTIwY2F1c2UlMjBoYXJtJTIwdG8lMjBodW1hbiUyMHN1YmplY3RzLiUyMiUwQWV4dHJhX2dhdGVkX2ZpZWxkcyUzQSUwQSUyMENvbXBhbnklM0ElMjB0ZXh0JTBBJTIwQ291bnRyeSUzQSUyMHRleHQlMEElMjBJJTIwYWdyZWUlMjB0byUyMHVzZSUyMHRoaXMlMjBtb2RlbCUyMGZvciUyMG5vbi1jb21tZXJjaWFsJTIwdXNlJTIwT05MWSUzQSUyMGNoZWNrYm94JTBBLS0t",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">extra_gated_prompt:</span> <span class="hljs-string">&quot;You agree to not use the model to conduct experiments that cause harm to human subjects.&quot;</span>
<span class="hljs-attr">extra_gated_fields:</span>
 <span class="hljs-attr">Company:</span> <span class="hljs-string">text</span>
 <span class="hljs-attr">Country:</span> <span class="hljs-string">text</span>
 <span class="hljs-attr">I agree to use this model for non-commercial use ONLY:</span> <span class="hljs-string">checkbox</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),J=new X({props:{title:"Manual approval",local:"manual-approval",headingTag:"h2"}}),G=new X({props:{title:"Notifications settings",local:"notifications-settings",headingTag:"h3"}}),P=new X({props:{title:"Additional Customization",local:"additional-customization",headingTag:"h2"}}),S=new we({props:{code:"LS0tJTBBZXh0cmFfZ2F0ZWRfaGVhZGluZyUzQSUyMCUyMkFja25vd2xlZGdlJTIwbGljZW5zZSUyMHRvJTIwYWNjZXB0JTIwdGhlJTIwcmVwb3NpdG9yeSUyMiUwQWV4dHJhX2dhdGVkX2J1dHRvbl9jb250ZW50JTNBJTIwJTIyQWNrbm93bGVkZ2UlMjBsaWNlbnNlJTIyJTBBLS0t",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">extra_gated_heading:</span> <span class="hljs-string">&quot;Acknowledge license to accept the repository&quot;</span>
<span class="hljs-attr">extra_gated_button_content:</span> <span class="hljs-string">&quot;Acknowledge license&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),{c(){r=i("meta"),E=o(),Y=i("p"),V=o(),c(y.$$.fragment),A=o(),$=i("p"),$.innerHTML=Me,Q=o(),w=i("p"),w.innerHTML=_e,F=o(),c(T.$$.fragment),D=o(),M=i("p"),M.textContent=qe,O=o(),c(_.$$.fragment),K=o(),q=i("p"),q.textContent=xe,ee=o(),x=i("p"),x.innerHTML=ke,te=o(),c(k.$$.fragment),ae=o(),j=i("p"),j.innerHTML=je,se=o(),c(H.$$.fragment),oe=o(),g=i("div"),g.innerHTML=He,ne=o(),C=i("p"),C.innerHTML=Ce,ie=o(),c(J.$$.fragment),le=o(),U=i("p"),U.innerHTML=Je,de=o(),b=i("div"),b.innerHTML=Ue,re=o(),B=i("p"),B.textContent=Be,ce=o(),Z=i("table"),Z.innerHTML=Ze,ue=o(),L=i("p"),L.innerHTML=Le,he=o(),c(G.$$.fragment),pe=o(),I=i("p"),I.textContent=Ge,me=o(),W=i("p"),W.textContent=Ie,fe=o(),v=i("div"),v.innerHTML=We,ge=o(),c(P.$$.fragment),be=o(),z=i("p"),z.innerHTML=Pe,ve=o(),c(S.$$.fragment),ye=o(),N=i("p"),this.h()},l(e){const t=Ee("svelte-u9bgzb",document.head);r=l(t,"META",{name:!0,content:!0}),t.forEach(a),E=n(e),Y=l(e,"P",{}),ze(Y).forEach(a),V=n(e),u(y.$$.fragment,e),A=n(e),$=l(e,"P",{"data-svelte-h":!0}),d($)!=="svelte-18ia315"&&($.innerHTML=Me),Q=n(e),w=l(e,"P",{"data-svelte-h":!0}),d(w)!=="svelte-1yqs8qk"&&(w.innerHTML=_e),F=n(e),u(T.$$.fragment,e),D=n(e),M=l(e,"P",{"data-svelte-h":!0}),d(M)!=="svelte-1fxhiip"&&(M.textContent=qe),O=n(e),u(_.$$.fragment,e),K=n(e),q=l(e,"P",{"data-svelte-h":!0}),d(q)!=="svelte-mff6bo"&&(q.textContent=xe),ee=n(e),x=l(e,"P",{"data-svelte-h":!0}),d(x)!=="svelte-fwnhi5"&&(x.innerHTML=ke),te=n(e),u(k.$$.fragment,e),ae=n(e),j=l(e,"P",{"data-svelte-h":!0}),d(j)!=="svelte-6syucv"&&(j.innerHTML=je),se=n(e),u(H.$$.fragment,e),oe=n(e),g=l(e,"DIV",{class:!0,"data-svelte-h":!0}),d(g)!=="svelte-rr4evd"&&(g.innerHTML=He),ne=n(e),C=l(e,"P",{"data-svelte-h":!0}),d(C)!=="svelte-1qjqxnn"&&(C.innerHTML=Ce),ie=n(e),u(J.$$.fragment,e),le=n(e),U=l(e,"P",{"data-svelte-h":!0}),d(U)!=="svelte-l2qz6a"&&(U.innerHTML=Je),de=n(e),b=l(e,"DIV",{class:!0,"data-svelte-h":!0}),d(b)!=="svelte-xwhznb"&&(b.innerHTML=Ue),re=n(e),B=l(e,"P",{"data-svelte-h":!0}),d(B)!=="svelte-dedsbo"&&(B.textContent=Be),ce=n(e),Z=l(e,"TABLE",{"data-svelte-h":!0}),d(Z)!=="svelte-2937ax"&&(Z.innerHTML=Ze),ue=n(e),L=l(e,"P",{"data-svelte-h":!0}),d(L)!=="svelte-gadjhb"&&(L.innerHTML=Le),he=n(e),u(G.$$.fragment,e),pe=n(e),I=l(e,"P",{"data-svelte-h":!0}),d(I)!=="svelte-3w5go9"&&(I.textContent=Ge),me=n(e),W=l(e,"P",{"data-svelte-h":!0}),d(W)!=="svelte-6o2ikb"&&(W.textContent=Ie),fe=n(e),v=l(e,"DIV",{class:!0,"data-svelte-h":!0}),d(v)!=="svelte-9ic7xj"&&(v.innerHTML=We),ge=n(e),u(P.$$.fragment,e),be=n(e),z=l(e,"P",{"data-svelte-h":!0}),d(z)!=="svelte-vchjsx"&&(z.innerHTML=Pe),ve=n(e),u(S.$$.fragment,e),ye=n(e),N=l(e,"P",{}),ze(N).forEach(a),this.h()},h(){R(r,"name","hf:doc:metadata"),R(r,"content",Qe),R(g,"class","flex justify-center"),R(b,"class","flex justify-center"),R(v,"class","flex justify-center")},m(e,t){Ve(document.head,r),s(e,E,t),s(e,Y,t),s(e,V,t),h(y,e,t),s(e,A,t),s(e,$,t),s(e,Q,t),s(e,w,t),s(e,F,t),h(T,e,t),s(e,D,t),s(e,M,t),s(e,O,t),h(_,e,t),s(e,K,t),s(e,q,t),s(e,ee,t),s(e,x,t),s(e,te,t),h(k,e,t),s(e,ae,t),s(e,j,t),s(e,se,t),h(H,e,t),s(e,oe,t),s(e,g,t),s(e,ne,t),s(e,C,t),s(e,ie,t),h(J,e,t),s(e,le,t),s(e,U,t),s(e,de,t),s(e,b,t),s(e,re,t),s(e,B,t),s(e,ce,t),s(e,Z,t),s(e,ue,t),s(e,L,t),s(e,he,t),h(G,e,t),s(e,pe,t),s(e,I,t),s(e,me,t),s(e,W,t),s(e,fe,t),s(e,v,t),s(e,ge,t),h(P,e,t),s(e,be,t),s(e,z,t),s(e,ve,t),h(S,e,t),s(e,ye,t),s(e,N,t),$e=!0},p:Ye,i(e){$e||(p(y.$$.fragment,e),p(T.$$.fragment,e),p(_.$$.fragment,e),p(k.$$.fragment,e),p(H.$$.fragment,e),p(J.$$.fragment,e),p(G.$$.fragment,e),p(P.$$.fragment,e),p(S.$$.fragment,e),$e=!0)},o(e){m(y.$$.fragment,e),m(T.$$.fragment,e),m(_.$$.fragment,e),m(k.$$.fragment,e),m(H.$$.fragment,e),m(J.$$.fragment,e),m(G.$$.fragment,e),m(P.$$.fragment,e),m(S.$$.fragment,e),$e=!1},d(e){e&&(a(E),a(Y),a(V),a(A),a($),a(Q),a(w),a(F),a(D),a(M),a(O),a(K),a(q),a(ee),a(x),a(te),a(ae),a(j),a(se),a(oe),a(g),a(ne),a(C),a(ie),a(le),a(U),a(de),a(b),a(re),a(B),a(ce),a(Z),a(ue),a(L),a(he),a(pe),a(I),a(me),a(W),a(fe),a(v),a(ge),a(be),a(z),a(ve),a(ye),a(N)),a(r),f(y,e),f(T,e),f(_,e),f(k,e),f(H,e),f(J,e),f(G,e),f(P,e),f(S,e)}}}const Qe='{"title":"Gated models","local":"gated-models","sections":[{"title":"Modifying the prompt","local":"modifying-the-prompt","sections":[],"depth":2},{"title":"Manual approval","local":"manual-approval","sections":[{"title":"Notifications settings","local":"notifications-settings","sections":[],"depth":3}],"depth":2},{"title":"Additional Customization","local":"additional-customization","sections":[],"depth":2}],"depth":1}';function Fe(Te){return Ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends Re{constructor(r){super(),Xe(this,r,Fe,Ae,Se,{})}}export{tt as component};
