import{s as Ie,f as ce,n as ve,o as je}from"../chunks/scheduler.37c15a92.js";import{S as $e,i as He,g as n,s as r,r as d,A as Ze,h as o,f as a,c as s,j as _,u as f,x as g,k as i,y as Ge,a as l,v as M,d as b,t as h,w as y}from"../chunks/index.2bf4358c.js";import{C as ue}from"../chunks/CodeBlock.4e987730.js";import{C as ke}from"../chunks/CourseFloatingBanner.6add7356.js";import{H as me,E as We}from"../chunks/getInferenceSnippets.8b9eb92a.js";function Ce(pe){let p,F,S,z,w,Q,J,V,T,ge=`Pentru a vă face viața și mai ușoară, Gradio se integrează direct cu Hugging Face Hub și Hugging Face Spaces.
Puteți încărca demo-uri din Hub și Spaces cu o singură <em>linie de cod</em>.`,E,U,N,x,de='Pentru a începe, alegeți unul dintre miile de modele pe care Hugging Face le oferă prin Hub, așa cum este descris în <a href="/course/chapter4/2">Capitolul 4</a>.',q,I,fe=`Folosind metoda specială <code>Interface.load()</code>, transmiteți <code>&quot;model/&quot;</code> (sau, echivalent, <code>&quot;huggingface/&quot;</code>)
urmată de numele modelului.
De exemplu, iată codul pentru a construi un demo pentru <a href="https://huggingface.co/EleutherAI/gpt-j-6B" rel="nofollow">GPT-J</a>, un model de limbaj mare, cu adăugarea a câtorva exemple de intrări:`,A,v,P,j,Me="Codul de mai sus va produce interfața de mai jos:",X,c,be,L,$,he=`Încărcarea unui model în acest mod folosește <a href="https://huggingface.co/inference-api" rel="nofollow">API-ul de Inferență</a> de la Hugging Face,
în loc să încarce modelul în memorie. Acest lucru este ideal pentru modele uriașe precum GPT-J sau T0pp care
necesită multă RAM.`,D,H,K,Z,ye="Pentru a încărca orice Space din Hugging Face Hub și a-l recrea local, puteți transmite <code>spaces/</code> la <code>Interface</code>, urmată de numele Space-ului.",O,G,we="Vă amintiți demo-ul din secțiunea 1 care elimina fundalul unei imagini? Să-l încărcăm din Hugging Face Spaces:",ee,k,te,u,Je,ae,W,Te=`Unul dintre lucrurile cool la încărcarea demo-urilor din Hub sau Spaces este că le puteți personaliza
prin suprascrierea oricăruia dintre
parametri. Aici, adăugăm un titlu și facem să funcționeze cu o webcam în schimb:`,le,C,ie,m,Ue,re,B,xe="Acum că am explorat câteva moduri de a integra Gradio cu Hugging Face Hub, să aruncăm o privire la câteva caracteristici avansate ale clasei <code>Interface</code>. Aceasta este tema următoarei secțiuni!",se,R,ne,Y,oe;return w=new me({props:{title:"Integrări cu Hugging Face Hub",local:"integrations-with-the-hugging-face-hub",headingTag:"h1"}}),J=new ke({props:{chapter:9,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter9/section5.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter9/section5.ipynb"}]}}),U=new me({props:{title:"Încărcarea modelelor din Hugging Face Hub",local:"loading-models-from-the-hugging-face-hub",headingTag:"h3"}}),v=new ue({props:{code:"aW1wb3J0JTIwZ3JhZGlvJTIwYXMlMjBnciUwQSUwQXRpdGxlJTIwJTNEJTIwJTIyR1BULUotNkIlMjIlMEFkZXNjcmlwdGlvbiUyMCUzRCUyMCUyMkdyYWRpbyUyMERlbW8lMjBmb3IlMjBHUFQtSiUyMDZCJTJDJTIwYSUyMHRyYW5zZm9ybWVyJTIwbW9kZWwlMjB0cmFpbmVkJTIwdXNpbmclMjBCZW4lMjBXYW5nJ3MlMjBNZXNoJTIwVHJhbnNmb3JtZXIlMjBKQVguJTIwJ0dQVC1KJyUyMHJlZmVycyUyMHRvJTIwdGhlJTIwY2xhc3MlMjBvZiUyMG1vZGVsJTJDJTIwd2hpbGUlMjAnNkInJTIwcmVwcmVzZW50cyUyMHRoZSUyMG51bWJlciUyMG9mJTIwdHJhaW5hYmxlJTIwcGFyYW1ldGVycy4lMjBUbyUyMHVzZSUyMGl0JTJDJTIwc2ltcGx5JTIwYWRkJTIweW91ciUyMHRleHQlMkMlMjBvciUyMGNsaWNrJTIwb25lJTIwb2YlMjB0aGUlMjBleGFtcGxlcyUyMHRvJTIwbG9hZCUyMHRoZW0uJTIwUmVhZCUyMG1vcmUlMjBhdCUyMHRoZSUyMGxpbmtzJTIwYmVsb3cuJTIyJTBBYXJ0aWNsZSUyMCUzRCUyMCUyMiUzQ3AlMjBzdHlsZSUzRCd0ZXh0LWFsaWduJTNBJTIwY2VudGVyJyUzRSUzQ2ElMjBocmVmJTNEJ2h0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmtpbmdvZmxvbHolMkZtZXNoLXRyYW5zZm9ybWVyLWpheCclMjB0YXJnZXQlM0QnX2JsYW5rJyUzRUdQVC1KLTZCJTNBJTIwQSUyMDYlMjBCaWxsaW9uJTIwUGFyYW1ldGVyJTIwQXV0b3JlZ3Jlc3NpdmUlMjBMYW5ndWFnZSUyME1vZGVsJTNDJTJGYSUzRSUzQyUyRnAlM0UlMjIlMEElMEFnci5JbnRlcmZhY2UubG9hZCglMEElMjAlMjAlMjAlMjAlMjJodWdnaW5nZmFjZSUyRkVsZXV0aGVyQUklMkZncHQtai02QiUyMiUyQyUwQSUyMCUyMCUyMCUyMGlucHV0cyUzRGdyLlRleHRib3gobGluZXMlM0Q1JTJDJTIwbGFiZWwlM0QlMjJJbnB1dCUyMFRleHQlMjIpJTJDJTBBJTIwJTIwJTIwJTIwdGl0bGUlM0R0aXRsZSUyQyUwQSUyMCUyMCUyMCUyMGRlc2NyaXB0aW9uJTNEZGVzY3JpcHRpb24lMkMlMEElMjAlMjAlMjAlMjBhcnRpY2xlJTNEYXJ0aWNsZSUyQyUwQSkubGF1bmNoKCk=",highlighted:`<span class="hljs-keyword">import</span> gradio <span class="hljs-keyword">as</span> gr

title = <span class="hljs-string">&quot;GPT-J-6B&quot;</span>
description = <span class="hljs-string">&quot;Gradio Demo for GPT-J 6B, a transformer model trained using Ben Wang&#x27;s Mesh Transformer JAX. &#x27;GPT-J&#x27; refers to the class of model, while &#x27;6B&#x27; represents the number of trainable parameters. To use it, simply add your text, or click one of the examples to load them. Read more at the links below.&quot;</span>
article = <span class="hljs-string">&quot;&lt;p style=&#x27;text-align: center&#x27;&gt;&lt;a href=&#x27;https://github.com/kingoflolz/mesh-transformer-jax&#x27; target=&#x27;_blank&#x27;&gt;GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model&lt;/a&gt;&lt;/p&gt;&quot;</span>

gr.Interface.load(
    <span class="hljs-string">&quot;huggingface/EleutherAI/gpt-j-6B&quot;</span>,
    inputs=gr.Textbox(lines=<span class="hljs-number">5</span>, label=<span class="hljs-string">&quot;Input Text&quot;</span>),
    title=title,
    description=description,
    article=article,
).launch()`,wrap:!1}}),H=new me({props:{title:"Încărcarea din Hugging Face Spaces",local:"loading-from-hugging-face-spaces",headingTag:"h3"}}),k=new ue({props:{code:"Z3IuSW50ZXJmYWNlLmxvYWQoJTIyc3BhY2VzJTJGYWJpZGxhYnMlMkZyZW1vdmUtYmclMjIpLmxhdW5jaCgp",highlighted:'gr.Interface.load(<span class="hljs-string">&quot;spaces/abidlabs/remove-bg&quot;</span>).launch()',wrap:!1}}),C=new ue({props:{code:"Z3IuSW50ZXJmYWNlLmxvYWQoJTBBJTIwJTIwJTIwJTIwJTIyc3BhY2VzJTJGYWJpZGxhYnMlMkZyZW1vdmUtYmclMjIlMkMlMjBpbnB1dHMlM0QlMjJ3ZWJjYW0lMjIlMkMlMjB0aXRsZSUzRCUyMlJlbW92ZSUyMHlvdXIlMjB3ZWJjYW0lMjBiYWNrZ3JvdW5kISUyMiUwQSkubGF1bmNoKCk=",highlighted:`gr.Interface.load(
    <span class="hljs-string">&quot;spaces/abidlabs/remove-bg&quot;</span>, inputs=<span class="hljs-string">&quot;webcam&quot;</span>, title=<span class="hljs-string">&quot;Remove your webcam background!&quot;</span>
).launch()`,wrap:!1}}),R=new We({props:{source:"https://github.com/huggingface/course/blob/main/chapters/rum/chapter9/5.mdx"}}),{c(){p=n("meta"),F=r(),S=n("p"),z=r(),d(w.$$.fragment),Q=r(),d(J.$$.fragment),V=r(),T=n("p"),T.innerHTML=ge,E=r(),d(U.$$.fragment),N=r(),x=n("p"),x.innerHTML=de,q=r(),I=n("p"),I.innerHTML=fe,A=r(),d(v.$$.fragment),P=r(),j=n("p"),j.textContent=Me,X=r(),c=n("iframe"),L=r(),$=n("p"),$.innerHTML=he,D=r(),d(H.$$.fragment),K=r(),Z=n("p"),Z.innerHTML=ye,O=r(),G=n("p"),G.textContent=we,ee=r(),d(k.$$.fragment),te=r(),u=n("iframe"),ae=r(),W=n("p"),W.textContent=Te,le=r(),d(C.$$.fragment),ie=r(),m=n("iframe"),re=r(),B=n("p"),B.innerHTML=xe,se=r(),d(R.$$.fragment),ne=r(),Y=n("p"),this.h()},l(e){const t=Ze("svelte-u9bgzb",document.head);p=o(t,"META",{name:!0,content:!0}),t.forEach(a),F=s(e),S=o(e,"P",{}),_(S).forEach(a),z=s(e),f(w.$$.fragment,e),Q=s(e),f(J.$$.fragment,e),V=s(e),T=o(e,"P",{"data-svelte-h":!0}),g(T)!=="svelte-5rx9bs"&&(T.innerHTML=ge),E=s(e),f(U.$$.fragment,e),N=s(e),x=o(e,"P",{"data-svelte-h":!0}),g(x)!=="svelte-184vyo2"&&(x.innerHTML=de),q=s(e),I=o(e,"P",{"data-svelte-h":!0}),g(I)!=="svelte-1lncx4t"&&(I.innerHTML=fe),A=s(e),f(v.$$.fragment,e),P=s(e),j=o(e,"P",{"data-svelte-h":!0}),g(j)!=="svelte-1swj0to"&&(j.textContent=Me),X=s(e),c=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),_(c).forEach(a),L=s(e),$=o(e,"P",{"data-svelte-h":!0}),g($)!=="svelte-k44qsu"&&($.innerHTML=he),D=s(e),f(H.$$.fragment,e),K=s(e),Z=o(e,"P",{"data-svelte-h":!0}),g(Z)!=="svelte-1qxmk2c"&&(Z.innerHTML=ye),O=s(e),G=o(e,"P",{"data-svelte-h":!0}),g(G)!=="svelte-skpmzt"&&(G.textContent=we),ee=s(e),f(k.$$.fragment,e),te=s(e),u=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),_(u).forEach(a),ae=s(e),W=o(e,"P",{"data-svelte-h":!0}),g(W)!=="svelte-53tq8a"&&(W.textContent=Te),le=s(e),f(C.$$.fragment,e),ie=s(e),m=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),_(m).forEach(a),re=s(e),B=o(e,"P",{"data-svelte-h":!0}),g(B)!=="svelte-1nyqn93"&&(B.innerHTML=xe),se=s(e),f(R.$$.fragment,e),ne=s(e),Y=o(e,"P",{}),_(Y).forEach(a),this.h()},h(){i(p,"name","hf:doc:metadata"),i(p,"content",Be),ce(c.src,be="https://course-demos-gpt-j-6B.hf.space")||i(c,"src",be),i(c,"frameborder","0"),i(c,"height","750"),i(c,"title","Gradio app"),i(c,"class","container p-0 flex-grow space-iframe"),i(c,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),i(c,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),ce(u.src,Je="https://course-demos-remove-bg-original.hf.space")||i(u,"src",Je),i(u,"frameborder","0"),i(u,"height","650"),i(u,"title","Gradio app"),i(u,"class","container p-0 flex-grow space-iframe"),i(u,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),i(u,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),ce(m.src,Ue="https://course-demos-Remove-bg.hf.space")||i(m,"src",Ue),i(m,"frameborder","0"),i(m,"height","550"),i(m,"title","Gradio app"),i(m,"class","container p-0 flex-grow space-iframe"),i(m,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),i(m,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads")},m(e,t){Ge(document.head,p),l(e,F,t),l(e,S,t),l(e,z,t),M(w,e,t),l(e,Q,t),M(J,e,t),l(e,V,t),l(e,T,t),l(e,E,t),M(U,e,t),l(e,N,t),l(e,x,t),l(e,q,t),l(e,I,t),l(e,A,t),M(v,e,t),l(e,P,t),l(e,j,t),l(e,X,t),l(e,c,t),l(e,L,t),l(e,$,t),l(e,D,t),M(H,e,t),l(e,K,t),l(e,Z,t),l(e,O,t),l(e,G,t),l(e,ee,t),M(k,e,t),l(e,te,t),l(e,u,t),l(e,ae,t),l(e,W,t),l(e,le,t),M(C,e,t),l(e,ie,t),l(e,m,t),l(e,re,t),l(e,B,t),l(e,se,t),M(R,e,t),l(e,ne,t),l(e,Y,t),oe=!0},p:ve,i(e){oe||(b(w.$$.fragment,e),b(J.$$.fragment,e),b(U.$$.fragment,e),b(v.$$.fragment,e),b(H.$$.fragment,e),b(k.$$.fragment,e),b(C.$$.fragment,e),b(R.$$.fragment,e),oe=!0)},o(e){h(w.$$.fragment,e),h(J.$$.fragment,e),h(U.$$.fragment,e),h(v.$$.fragment,e),h(H.$$.fragment,e),h(k.$$.fragment,e),h(C.$$.fragment,e),h(R.$$.fragment,e),oe=!1},d(e){e&&(a(F),a(S),a(z),a(Q),a(V),a(T),a(E),a(N),a(x),a(q),a(I),a(A),a(P),a(j),a(X),a(c),a(L),a($),a(D),a(K),a(Z),a(O),a(G),a(ee),a(te),a(u),a(ae),a(W),a(le),a(ie),a(m),a(re),a(B),a(se),a(ne),a(Y)),a(p),y(w,e),y(J,e),y(U,e),y(v,e),y(H,e),y(k,e),y(C,e),y(R,e)}}}const Be='{"title":"Integrări cu Hugging Face Hub","local":"integrations-with-the-hugging-face-hub","sections":[{"title":"Încărcarea modelelor din Hugging Face Hub","local":"loading-models-from-the-hugging-face-hub","sections":[],"depth":3},{"title":"Încărcarea din Hugging Face Spaces","local":"loading-from-hugging-face-spaces","sections":[],"depth":3}],"depth":1}';function Re(pe){return je(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qe extends $e{constructor(p){super(),He(this,p,Re,Ce,Ie,{})}}export{Qe as component};
