import{s as ve,a as ue,n as je,o as He}from"../chunks/scheduler.893fe8c9.js";import{S as Ze,i as Ge,e as s,s as i,c as g,h as Ce,a as o,d as a,b as r,f as z,g as d,j as f,k as n,l as ke,m as l,n as M,t as b,o as y,p as h}from"../chunks/index.6ee278c6.js";import{C as We,H as pe,E as Be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.ea3ad860.js";import{C as ge}from"../chunks/CodeBlock.8bdd5f33.js";import{C as Re}from"../chunks/CourseFloatingBanner.c25cfa5e.js";function Se(de){let p,F,Y,Q,w,V,J,E,T,N,U,fe=`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>.`,q,x,P,$,Me='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>.',A,I,be=`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:`,L,v,X,j,ye="Codul de mai sus va produce interfața de mai jos:",D,c,he,K,H,we=`Î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.`,O,Z,ee,G,Je="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.",te,C,Te="Vă amintiți demo-ul din secțiunea 1 care elimina fundalul unei imagini? Să-l încărcăm din Hugging Face Spaces:",ae,k,le,m,Ue,ie,W,xe=`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:`,re,B,ne,u,$e,se,R,Ie="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!",oe,S,ce,_,me;return w=new We({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),J=new pe({props:{title:"Integrări cu Hugging Face Hub",local:"integrations-with-the-hugging-face-hub",headingTag:"h1"}}),T=new Re({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"}]}}),x=new pe({props:{title:"Încărcarea modelelor din Hugging Face Hub",local:"loading-models-from-the-hugging-face-hub",headingTag:"h3"}}),v=new ge({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}}),Z=new pe({props:{title:"Încărcarea din Hugging Face Spaces",local:"loading-from-hugging-face-spaces",headingTag:"h3"}}),k=new ge({props:{code:"Z3IuSW50ZXJmYWNlLmxvYWQoJTIyc3BhY2VzJTJGYWJpZGxhYnMlMkZyZW1vdmUtYmclMjIpLmxhdW5jaCgp",highlighted:'gr.Interface.load(<span class="hljs-string">&quot;spaces/abidlabs/remove-bg&quot;</span>).launch()',wrap:!1}}),B=new ge({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}}),S=new Be({props:{source:"https://github.com/huggingface/course/blob/main/chapters/ro/chapter9/5.mdx"}}),{c(){p=s("meta"),F=i(),Y=s("p"),Q=i(),g(w.$$.fragment),V=i(),g(J.$$.fragment),E=i(),g(T.$$.fragment),N=i(),U=s("p"),U.innerHTML=fe,q=i(),g(x.$$.fragment),P=i(),$=s("p"),$.innerHTML=Me,A=i(),I=s("p"),I.innerHTML=be,L=i(),g(v.$$.fragment),X=i(),j=s("p"),j.textContent=ye,D=i(),c=s("iframe"),K=i(),H=s("p"),H.innerHTML=we,O=i(),g(Z.$$.fragment),ee=i(),G=s("p"),G.innerHTML=Je,te=i(),C=s("p"),C.textContent=Te,ae=i(),g(k.$$.fragment),le=i(),m=s("iframe"),ie=i(),W=s("p"),W.textContent=xe,re=i(),g(B.$$.fragment),ne=i(),u=s("iframe"),se=i(),R=s("p"),R.innerHTML=Ie,oe=i(),g(S.$$.fragment),ce=i(),_=s("p"),this.h()},l(e){const t=Ce("svelte-u9bgzb",document.head);p=o(t,"META",{name:!0,content:!0}),t.forEach(a),F=r(e),Y=o(e,"P",{}),z(Y).forEach(a),Q=r(e),d(w.$$.fragment,e),V=r(e),d(J.$$.fragment,e),E=r(e),d(T.$$.fragment,e),N=r(e),U=o(e,"P",{"data-svelte-h":!0}),f(U)!=="svelte-5rx9bs"&&(U.innerHTML=fe),q=r(e),d(x.$$.fragment,e),P=r(e),$=o(e,"P",{"data-svelte-h":!0}),f($)!=="svelte-184vyo2"&&($.innerHTML=Me),A=r(e),I=o(e,"P",{"data-svelte-h":!0}),f(I)!=="svelte-1lncx4t"&&(I.innerHTML=be),L=r(e),d(v.$$.fragment,e),X=r(e),j=o(e,"P",{"data-svelte-h":!0}),f(j)!=="svelte-1swj0to"&&(j.textContent=ye),D=r(e),c=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),z(c).forEach(a),K=r(e),H=o(e,"P",{"data-svelte-h":!0}),f(H)!=="svelte-k44qsu"&&(H.innerHTML=we),O=r(e),d(Z.$$.fragment,e),ee=r(e),G=o(e,"P",{"data-svelte-h":!0}),f(G)!=="svelte-1qxmk2c"&&(G.innerHTML=Je),te=r(e),C=o(e,"P",{"data-svelte-h":!0}),f(C)!=="svelte-skpmzt"&&(C.textContent=Te),ae=r(e),d(k.$$.fragment,e),le=r(e),m=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),z(m).forEach(a),ie=r(e),W=o(e,"P",{"data-svelte-h":!0}),f(W)!=="svelte-53tq8a"&&(W.textContent=xe),re=r(e),d(B.$$.fragment,e),ne=r(e),u=o(e,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),z(u).forEach(a),se=r(e),R=o(e,"P",{"data-svelte-h":!0}),f(R)!=="svelte-1nyqn93"&&(R.innerHTML=Ie),oe=r(e),d(S.$$.fragment,e),ce=r(e),_=o(e,"P",{}),z(_).forEach(a),this.h()},h(){n(p,"name","hf:doc:metadata"),n(p,"content",Ye),ue(c.src,he="https://course-demos-gpt-j-6B.hf.space")||n(c,"src",he),n(c,"frameborder","0"),n(c,"height","750"),n(c,"title","Gradio app"),n(c,"class","container p-0 flex-grow space-iframe"),n(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"),n(c,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),ue(m.src,Ue="https://course-demos-remove-bg-original.hf.space")||n(m,"src",Ue),n(m,"frameborder","0"),n(m,"height","650"),n(m,"title","Gradio app"),n(m,"class","container p-0 flex-grow space-iframe"),n(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"),n(m,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),ue(u.src,$e="https://course-demos-Remove-bg.hf.space")||n(u,"src",$e),n(u,"frameborder","0"),n(u,"height","550"),n(u,"title","Gradio app"),n(u,"class","container p-0 flex-grow space-iframe"),n(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"),n(u,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads")},m(e,t){ke(document.head,p),l(e,F,t),l(e,Y,t),l(e,Q,t),M(w,e,t),l(e,V,t),M(J,e,t),l(e,E,t),M(T,e,t),l(e,N,t),l(e,U,t),l(e,q,t),M(x,e,t),l(e,P,t),l(e,$,t),l(e,A,t),l(e,I,t),l(e,L,t),M(v,e,t),l(e,X,t),l(e,j,t),l(e,D,t),l(e,c,t),l(e,K,t),l(e,H,t),l(e,O,t),M(Z,e,t),l(e,ee,t),l(e,G,t),l(e,te,t),l(e,C,t),l(e,ae,t),M(k,e,t),l(e,le,t),l(e,m,t),l(e,ie,t),l(e,W,t),l(e,re,t),M(B,e,t),l(e,ne,t),l(e,u,t),l(e,se,t),l(e,R,t),l(e,oe,t),M(S,e,t),l(e,ce,t),l(e,_,t),me=!0},p:je,i(e){me||(b(w.$$.fragment,e),b(J.$$.fragment,e),b(T.$$.fragment,e),b(x.$$.fragment,e),b(v.$$.fragment,e),b(Z.$$.fragment,e),b(k.$$.fragment,e),b(B.$$.fragment,e),b(S.$$.fragment,e),me=!0)},o(e){y(w.$$.fragment,e),y(J.$$.fragment,e),y(T.$$.fragment,e),y(x.$$.fragment,e),y(v.$$.fragment,e),y(Z.$$.fragment,e),y(k.$$.fragment,e),y(B.$$.fragment,e),y(S.$$.fragment,e),me=!1},d(e){e&&(a(F),a(Y),a(Q),a(V),a(E),a(N),a(U),a(q),a(P),a($),a(A),a(I),a(L),a(X),a(j),a(D),a(c),a(K),a(H),a(O),a(ee),a(G),a(te),a(C),a(ae),a(le),a(m),a(ie),a(W),a(re),a(ne),a(u),a(se),a(R),a(oe),a(ce),a(_)),a(p),h(w,e),h(J,e),h(T,e),h(x,e),h(v,e),h(Z,e),h(k,e),h(B,e),h(S,e)}}}const Ye='{"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 _e(de){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ne extends Ze{constructor(p){super(),Ge(this,p,_e,Se,ve,{})}}export{Ne as component};
