import{s as ve,n as Te,o as He}from"../chunks/scheduler.d6170356.js";import{S as xe,i as Ue,g as n,s,r as m,A as je,h as o,f as a,c as l,j as _e,u as p,x as r,k as re,y as ke,a as i,v as h,d as u,t as c,w as d}from"../chunks/index.fcd4cc08.js";import{C as fe}from"../chunks/CodeBlock.db16bf50.js";import{H as P,E as Je}from"../chunks/getInferenceSnippets.0f6acb26.js";function Ce(me){let f,X,G,Y,y,W,w,pe="<code>fastai</code> is an open-source Deep Learning library that leverages PyTorch and Python to provide high-level components to train fast and accurate neural networks with state-of-the-art outputs on text, vision, and tabular data.",N,$,V,M,he='You can find <code>fastai</code> models by filtering at the left of the <a href="https://huggingface.co/models?library=fastai&amp;sort=downloads" rel="nofollow">models page</a>.',A,_,ue="All models on the Hub come up with the following features:",Q,v,ce="<li>An automatically generated model card with a brief description and metadata tags that help for discoverability.</li> <li>An interactive widget you can use to play out with the model directly in the browser (for Image Classification)</li> <li>An Inference API that allows to make inference requests (for Image Classification).</li>",F,T,q,H,de="The <code>huggingface_hub</code> library is a lightweight Python client with utlity functions to download models from the Hub.",B,x,R,U,ge="Once you have the library installed, you just need to use the <code>from_pretrained_fastai</code> method. This method not only loads the model, but also validates the <code>fastai</code> version when the model was saved, which is important for reproducibility.",z,j,D,k,be="If you want to see how to load a specific model, you can click <code>Use in fastai</code> and you will be given a working snippet that you can load it!",O,g,ye='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet1.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet1-dark.png"/>',K,b,we='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet2.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet2-dark.png"/>',ee,J,te,C,$e="You can share your <code>fastai</code> models by using the <code>push_to_hub_fastai</code> method.",ae,L,ie,E,se,I,Me='<li>fastai <a href="https://course.fast.ai/" rel="nofollow">course</a>.</li> <li>fastai <a href="https://www.fast.ai/" rel="nofollow">website</a>.</li> <li>Integration with Hub <a href="https://docs.fast.ai/huggingface.html" rel="nofollow">docs</a>.</li> <li>Integration with Hub <a href="https://huggingface.co/blog/fastai" rel="nofollow">announcement</a>.</li>',le,Z,ne,S,oe;return y=new P({props:{title:"Using fastai at Hugging Face",local:"using-fastai-at-hugging-face",headingTag:"h1"}}),$=new P({props:{title:"Exploring fastai in the Hub",local:"exploring-fastai-in-the-hub",headingTag:"h2"}}),T=new P({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),x=new fe({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1YiU1QiUyMmZhc3RhaSUyMiU1RA==",highlighted:'pip install huggingface_hub[<span class="hljs-string">&quot;fastai&quot;</span>]',wrap:!1}}),j=new fe({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGZyb21fcHJldHJhaW5lZF9mYXN0YWklMEElMEFsZWFybmVyJTIwJTNEJTIwZnJvbV9wcmV0cmFpbmVkX2Zhc3RhaSglMjJlc3BlamVsb21hciUyRmlkZW50aWZ5LW15LWNhdCUyMiklMEElMEFfJTJDXyUyQ3Byb2JzJTIwJTNEJTIwbGVhcm5lci5wcmVkaWN0KGltZyklMEFwcmludChmJTIyUHJvYmFiaWxpdHklMjBpdCdzJTIwYSUyMGNhdCUzQSUyMCU3QjEwMCpwcm9icyU1QjElNUQuaXRlbSgpJTNBLjJmJTdEJTI1JTIyKSUwQSUwQSUyMyUyMFByb2JhYmlsaXR5JTIwaXQncyUyMGElMjBjYXQlM0ElMjAxMDAuMDAlMjU=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> from_pretrained_fastai

learner = from_pretrained_fastai(<span class="hljs-string">&quot;espejelomar/identify-my-cat&quot;</span>)

_,_,probs = learner.predict(img)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Probability it&#x27;s a cat: <span class="hljs-subst">{<span class="hljs-number">100</span>*probs[<span class="hljs-number">1</span>].item():<span class="hljs-number">.2</span>f}</span>%&quot;</span>)

<span class="hljs-comment"># Probability it&#x27;s a cat: 100.00%</span>`,wrap:!1}}),J=new P({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),L=new fe({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHB1c2hfdG9faHViX2Zhc3RhaSUwQSUwQXB1c2hfdG9faHViX2Zhc3RhaShsZWFybmVyJTNEbGVhcm4lMkMlMjByZXBvX2lkJTNEJTIyZXNwZWplbG9tYXIlMkZpZGVudGlmeS1teS1jYXQlMjIp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> push_to_hub_fastai

push_to_hub_fastai(learner=learn, repo_id=<span class="hljs-string">&quot;espejelomar/identify-my-cat&quot;</span>)`,wrap:!1}}),E=new P({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),Z=new Je({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/fastai.md"}}),{c(){f=n("meta"),X=s(),G=n("p"),Y=s(),m(y.$$.fragment),W=s(),w=n("p"),w.innerHTML=pe,N=s(),m($.$$.fragment),V=s(),M=n("p"),M.innerHTML=he,A=s(),_=n("p"),_.textContent=ue,Q=s(),v=n("ol"),v.innerHTML=ce,F=s(),m(T.$$.fragment),q=s(),H=n("p"),H.innerHTML=de,B=s(),m(x.$$.fragment),R=s(),U=n("p"),U.innerHTML=ge,z=s(),m(j.$$.fragment),D=s(),k=n("p"),k.innerHTML=be,O=s(),g=n("div"),g.innerHTML=ye,K=s(),b=n("div"),b.innerHTML=we,ee=s(),m(J.$$.fragment),te=s(),C=n("p"),C.innerHTML=$e,ae=s(),m(L.$$.fragment),ie=s(),m(E.$$.fragment),se=s(),I=n("ul"),I.innerHTML=Me,le=s(),m(Z.$$.fragment),ne=s(),S=n("p"),this.h()},l(e){const t=je("svelte-u9bgzb",document.head);f=o(t,"META",{name:!0,content:!0}),t.forEach(a),X=l(e),G=o(e,"P",{}),_e(G).forEach(a),Y=l(e),p(y.$$.fragment,e),W=l(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-1rea5ra"&&(w.innerHTML=pe),N=l(e),p($.$$.fragment,e),V=l(e),M=o(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-38bw3m"&&(M.innerHTML=he),A=l(e),_=o(e,"P",{"data-svelte-h":!0}),r(_)!=="svelte-t2majo"&&(_.textContent=ue),Q=l(e),v=o(e,"OL",{"data-svelte-h":!0}),r(v)!=="svelte-ay7wwo"&&(v.innerHTML=ce),F=l(e),p(T.$$.fragment,e),q=l(e),H=o(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-cr1x44"&&(H.innerHTML=de),B=l(e),p(x.$$.fragment,e),R=l(e),U=o(e,"P",{"data-svelte-h":!0}),r(U)!=="svelte-z2hjhy"&&(U.innerHTML=ge),z=l(e),p(j.$$.fragment,e),D=l(e),k=o(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-6jxo3y"&&(k.innerHTML=be),O=l(e),g=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(g)!=="svelte-1c4onc7"&&(g.innerHTML=ye),K=l(e),b=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(b)!=="svelte-13w5uxr"&&(b.innerHTML=we),ee=l(e),p(J.$$.fragment,e),te=l(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1bqitop"&&(C.innerHTML=$e),ae=l(e),p(L.$$.fragment,e),ie=l(e),p(E.$$.fragment,e),se=l(e),I=o(e,"UL",{"data-svelte-h":!0}),r(I)!=="svelte-1x3ci0b"&&(I.innerHTML=Me),le=l(e),p(Z.$$.fragment,e),ne=l(e),S=o(e,"P",{}),_e(S).forEach(a),this.h()},h(){re(f,"name","hf:doc:metadata"),re(f,"content",Le),re(g,"class","flex justify-center"),re(b,"class","flex justify-center")},m(e,t){ke(document.head,f),i(e,X,t),i(e,G,t),i(e,Y,t),h(y,e,t),i(e,W,t),i(e,w,t),i(e,N,t),h($,e,t),i(e,V,t),i(e,M,t),i(e,A,t),i(e,_,t),i(e,Q,t),i(e,v,t),i(e,F,t),h(T,e,t),i(e,q,t),i(e,H,t),i(e,B,t),h(x,e,t),i(e,R,t),i(e,U,t),i(e,z,t),h(j,e,t),i(e,D,t),i(e,k,t),i(e,O,t),i(e,g,t),i(e,K,t),i(e,b,t),i(e,ee,t),h(J,e,t),i(e,te,t),i(e,C,t),i(e,ae,t),h(L,e,t),i(e,ie,t),h(E,e,t),i(e,se,t),i(e,I,t),i(e,le,t),h(Z,e,t),i(e,ne,t),i(e,S,t),oe=!0},p:Te,i(e){oe||(u(y.$$.fragment,e),u($.$$.fragment,e),u(T.$$.fragment,e),u(x.$$.fragment,e),u(j.$$.fragment,e),u(J.$$.fragment,e),u(L.$$.fragment,e),u(E.$$.fragment,e),u(Z.$$.fragment,e),oe=!0)},o(e){c(y.$$.fragment,e),c($.$$.fragment,e),c(T.$$.fragment,e),c(x.$$.fragment,e),c(j.$$.fragment,e),c(J.$$.fragment,e),c(L.$$.fragment,e),c(E.$$.fragment,e),c(Z.$$.fragment,e),oe=!1},d(e){e&&(a(X),a(G),a(Y),a(W),a(w),a(N),a(V),a(M),a(A),a(_),a(Q),a(v),a(F),a(q),a(H),a(B),a(R),a(U),a(z),a(D),a(k),a(O),a(g),a(K),a(b),a(ee),a(te),a(C),a(ae),a(ie),a(se),a(I),a(le),a(ne),a(S)),a(f),d(y,e),d($,e),d(T,e),d(x,e),d(j,e),d(J,e),d(L,e),d(E,e),d(Z,e)}}}const Le='{"title":"Using fastai at Hugging Face","local":"using-fastai-at-hugging-face","sections":[{"title":"Exploring fastai in the Hub","local":"exploring-fastai-in-the-hub","sections":[],"depth":2},{"title":"Using existing models","local":"using-existing-models","sections":[],"depth":2},{"title":"Sharing your models","local":"sharing-your-models","sections":[],"depth":2},{"title":"Additional resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function Ee(me){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pe extends xe{constructor(f){super(),Ue(this,f,Ee,Ce,ve,{})}}export{Pe as component};
