import{s as ee,n as te,o as ae}from"../chunks/scheduler.d6170356.js";import{S as se,i as le,g as r,s as l,r as w,A as ne,h as i,f as a,c as n,j as K,u as J,x as _,k as N,y as oe,a as s,v as U,d as $,t as v,w as j}from"../chunks/index.fcd4cc08.js";import{C as D}from"../chunks/CodeBlock.db16bf50.js";import{H as O,E as re}from"../chunks/index.c1f68a2b.js";function ie(X){let o,H,k,Z,m,C,u,q='<code>tf-keras</code> is the name given to Keras 2.x version. It is now hosted as a separate GitHub repo <a href="https://github.com/keras-team/tf-keras" rel="nofollow">here</a>. Though it’s a legacy framework, there are still <a href="https://huggingface.co/models?library=tf-keras&amp;sort=trending" rel="nofollow">4.5k+ models</a> hosted on the Hub. These models can be loaded using the <code>huggingface_hub</code> library. You <strong>must</strong> have either <code>tf-keras</code> or <code>keras&lt;3.x</code> installed on your machine.',x,c,S='If you are interested in Keras 3.x support, check out <a href="./keras">this guide</a>.',G,p,E='Once installed, you just need to use the <code>from_pretrained_keras</code> method to load a model from the Hub. Read more about <code>from_pretrained_keras</code> <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/mixins#huggingface_hub.from_pretrained_keras" rel="nofollow">here</a>.',W,d,I,h,Q='You can also host your <code>tf-keras</code> model on the Hub. However, keep in mind that <code>tf-keras</code> is a legacy framework. To reach a maximum number of users, we recommend to create your model using Keras 3.x and share it natively as described above. For more details about uploading <code>tf-keras</code> models, check out <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/mixins#huggingface_hub.push_to_hub_keras" rel="nofollow"><code>push_to_hub_keras</code> documentation</a>.',B,f,L,g,R,b,P='<li><a href="https://github.com/keras-team/tf-keras" rel="nofollow">GitHub repo</a></li>',Y,y,A='<li>Blog post <a href="https://merveenoyan.medium.com/putting-keras-on-hub-for-collaborative-training-and-reproducibility-9018301de877" rel="nofollow">Putting Keras on 🤗 Hub for Collaborative Training and Reproducibility</a> (April 2022)</li>',z,M,F,T,V;return m=new O({props:{title:"TF-Keras (legacy)",local:"tf-keras-legacy",headingTag:"h2"}}),d=new D({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGZyb21fcHJldHJhaW5lZF9rZXJhcyUwQSUwQW1vZGVsJTIwJTNEJTIwZnJvbV9wcmV0cmFpbmVkX2tlcmFzKCUyMmtlcmFzLWlvJTJGbW9iaWxlLXZpdC14eHMlMjIpJTBBcHJlZGljdGlvbiUyMCUzRCUyMG1vZGVsLnByZWRpY3QoaW1hZ2UpJTBBcHJlZGljdGlvbiUyMCUzRCUyMHRmLnNxdWVlemUodGYucm91bmQocHJlZGljdGlvbikpJTBBcHJpbnQoZidUaGUlMjBpbWFnZSUyMGlzJTIwYSUyMCU3QmNsYXNzZXMlNUIobnAuYXJnbWF4KHByZWRpY3Rpb24pKSU1RCU3RCEnKSUwQSUwQSUyMyUyMFRoZSUyMGltYWdlJTIwaXMlMjBhJTIwc3VuZmxvd2VyIQ==",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> from_pretrained_keras

model = from_pretrained_keras(<span class="hljs-string">&quot;keras-io/mobile-vit-xxs&quot;</span>)
prediction = model.predict(image)
prediction = tf.squeeze(tf.<span class="hljs-built_in">round</span>(prediction))
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&#x27;The image is a <span class="hljs-subst">{classes[(np.argmax(prediction))]}</span>!&#x27;</span>)

<span class="hljs-comment"># The image is a sunflower!</span>`,wrap:!1}}),f=new D({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHB1c2hfdG9faHViX2tlcmFzJTBBJTBBcHVzaF90b19odWJfa2VyYXMobW9kZWwlMkMlMEElMjAlMjAlMjAlMjAlMjJ5b3VyLXVzZXJuYW1lJTJGeW91ci1tb2RlbC1uYW1lJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyeW91ci10ZW5zb3Jib2FyZC1sb2ctZGlyZWN0b3J5JTIyJTJDJTBBJTIwJTIwJTIwJTIwdGFncyUyMCUzRCUyMCU1QiUyMm9iamVjdC1kZXRlY3Rpb24lMjIlMkMlMjAlMjJzb21lX290aGVyX3RhZyUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCoqbW9kZWxfc2F2ZV9rd2FyZ3MlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> push_to_hub_keras

push_to_hub_keras(model,
    <span class="hljs-string">&quot;your-username/your-model-name&quot;</span>,
    <span class="hljs-string">&quot;your-tensorboard-log-directory&quot;</span>,
    tags = [<span class="hljs-string">&quot;object-detection&quot;</span>, <span class="hljs-string">&quot;some_other_tag&quot;</span>],
    **model_save_kwargs,
)`,wrap:!1}}),g=new O({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),M=new re({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/tf-keras.md"}}),{c(){o=r("meta"),H=l(),k=r("p"),Z=l(),w(m.$$.fragment),C=l(),u=r("p"),u.innerHTML=q,x=l(),c=r("p"),c.innerHTML=S,G=l(),p=r("p"),p.innerHTML=E,W=l(),w(d.$$.fragment),I=l(),h=r("p"),h.innerHTML=Q,B=l(),w(f.$$.fragment),L=l(),w(g.$$.fragment),R=l(),b=r("ul"),b.innerHTML=P,Y=l(),y=r("ul"),y.innerHTML=A,z=l(),w(M.$$.fragment),F=l(),T=r("p"),this.h()},l(e){const t=ne("svelte-u9bgzb",document.head);o=i(t,"META",{name:!0,content:!0}),t.forEach(a),H=n(e),k=i(e,"P",{}),K(k).forEach(a),Z=n(e),J(m.$$.fragment,e),C=n(e),u=i(e,"P",{"data-svelte-h":!0}),_(u)!=="svelte-tvrbr1"&&(u.innerHTML=q),x=n(e),c=i(e,"P",{"data-svelte-h":!0}),_(c)!=="svelte-jxevjs"&&(c.innerHTML=S),G=n(e),p=i(e,"P",{"data-svelte-h":!0}),_(p)!=="svelte-tsd7s7"&&(p.innerHTML=E),W=n(e),J(d.$$.fragment,e),I=n(e),h=i(e,"P",{"data-svelte-h":!0}),_(h)!=="svelte-zsxzup"&&(h.innerHTML=Q),B=n(e),J(f.$$.fragment,e),L=n(e),J(g.$$.fragment,e),R=n(e),b=i(e,"UL",{"data-svelte-h":!0}),_(b)!=="svelte-qx2gyh"&&(b.innerHTML=P),Y=n(e),y=i(e,"UL",{"data-svelte-h":!0}),_(y)!=="svelte-125l45p"&&(y.innerHTML=A),z=n(e),J(M.$$.fragment,e),F=n(e),T=i(e,"P",{}),K(T).forEach(a),this.h()},h(){N(o,"name","hf:doc:metadata"),N(o,"content",me)},m(e,t){oe(document.head,o),s(e,H,t),s(e,k,t),s(e,Z,t),U(m,e,t),s(e,C,t),s(e,u,t),s(e,x,t),s(e,c,t),s(e,G,t),s(e,p,t),s(e,W,t),U(d,e,t),s(e,I,t),s(e,h,t),s(e,B,t),U(f,e,t),s(e,L,t),U(g,e,t),s(e,R,t),s(e,b,t),s(e,Y,t),s(e,y,t),s(e,z,t),U(M,e,t),s(e,F,t),s(e,T,t),V=!0},p:te,i(e){V||($(m.$$.fragment,e),$(d.$$.fragment,e),$(f.$$.fragment,e),$(g.$$.fragment,e),$(M.$$.fragment,e),V=!0)},o(e){v(m.$$.fragment,e),v(d.$$.fragment,e),v(f.$$.fragment,e),v(g.$$.fragment,e),v(M.$$.fragment,e),V=!1},d(e){e&&(a(H),a(k),a(Z),a(C),a(u),a(x),a(c),a(G),a(p),a(W),a(I),a(h),a(B),a(L),a(R),a(b),a(Y),a(y),a(z),a(F),a(T)),a(o),j(m,e),j(d,e),j(f,e),j(g,e),j(M,e)}}}const me='{"title":"TF-Keras (legacy)","local":"tf-keras-legacy","sections":[],"depth":2}';function ue(X){return ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fe extends se{constructor(o){super(),le(this,o,ue,ie,ee,{})}}export{fe as component};
