import{s as ee,n as te,o as ae}from"../chunks/scheduler.9cda857a.js";import{S as se,i as le,e as r,s as l,c as _,h as ne,a as i,d as a,b as n,f as P,g as k,j as T,k as K,l as oe,m as s,n as w,t as Z,o as $,p as G}from"../chunks/index.f47f3121.js";import{C as D}from"../chunks/CodeBlock.24d62f98.js";import{H as O,E as re}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.64d112fc.js";function ie(F){let o,j,J,v,m,H,p,X='<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.',C,u,V='If you are interested in Keras 3.x support, check out <a href="./keras">this guide</a>.',x,c,Y='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,z,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,I,b,L,g,N='<li><a href="https://github.com/keras-team/tf-keras" rel="nofollow">GitHub repo</a></li>',R,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>',S,M,Q,U,E;return m=new O({props:{title:"TF-Keras (legacy)",local:"tf-keras-legacy",headingTag:"h2"}}),d=new D({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGZyb21fcHJldHJhaW5lZF9rZXJhcyUwQSUwQW1vZGVsJTIwJTNEJTIwZnJvbV9wcmV0cmFpbmVkX2tlcmFzKCUyMmtlcmFzLWlvJTJGbW9iaWxlLXZpdC14eHMlMjIpJTBBcHJlZGljdGlvbiUyMCUzRCUyMG1vZGVsLnByZWRpY3QoaW1hZ2UpJTBBcHJlZGljdGlvbiUyMCUzRCUyMHRmLnNxdWVlemUodGYucm91bmQocHJlZGljdGlvbikpJTBBcHJpbnQoZidUaGUlMjBpbWFnZSUyMGlzJTIwYSUyMCU3QmNsYXNzZXMlNUIobnAuYXJnbWF4KHByZWRpY3Rpb24pKSU1RCU3RCEnKSUwQSUwQSUzQ0NvcHlMTE1UeHRNZW51JTIwY29udGFpbmVyU3R5bGUlM0QlMjJmbG9hdCUzQSUyMHJpZ2h0JTNCJTIwbWFyZ2luLWxlZnQlM0ElMjAxMHB4JTNCJTIwZGlzcGxheSUzQSUyMGlubGluZS1mbGV4JTNCJTIwcG9zaXRpb24lM0ElMjByZWxhdGl2ZSUzQiUyMHotaW5kZXglM0ElMjAxMCUzQiUyMiUzRSUzQyUyRkNvcHlMTE1UeHRNZW51JTNFJTBBJTBBJTIzJTIwVGhlJTIwaW1hZ2UlMjBpcyUyMGElMjBzdW5mbG93ZXIh",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>)

&lt;CopyLLMTxtMenu containerStyle=<span class="hljs-string">&quot;float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;&quot;</span>&gt;&lt;/CopyLLMTxtMenu&gt;

<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}}),b=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"),j=l(),J=r("p"),v=l(),_(m.$$.fragment),H=l(),p=r("p"),p.innerHTML=X,C=l(),u=r("p"),u.innerHTML=V,x=l(),c=r("p"),c.innerHTML=Y,W=l(),_(d.$$.fragment),z=l(),h=r("p"),h.innerHTML=q,B=l(),_(f.$$.fragment),I=l(),_(b.$$.fragment),L=l(),g=r("ul"),g.innerHTML=N,R=l(),y=r("ul"),y.innerHTML=A,S=l(),_(M.$$.fragment),Q=l(),U=r("p"),this.h()},l(e){const t=ne("svelte-u9bgzb",document.head);o=i(t,"META",{name:!0,content:!0}),t.forEach(a),j=n(e),J=i(e,"P",{}),P(J).forEach(a),v=n(e),k(m.$$.fragment,e),H=n(e),p=i(e,"P",{"data-svelte-h":!0}),T(p)!=="svelte-tvrbr1"&&(p.innerHTML=X),C=n(e),u=i(e,"P",{"data-svelte-h":!0}),T(u)!=="svelte-jxevjs"&&(u.innerHTML=V),x=n(e),c=i(e,"P",{"data-svelte-h":!0}),T(c)!=="svelte-tsd7s7"&&(c.innerHTML=Y),W=n(e),k(d.$$.fragment,e),z=n(e),h=i(e,"P",{"data-svelte-h":!0}),T(h)!=="svelte-zsxzup"&&(h.innerHTML=q),B=n(e),k(f.$$.fragment,e),I=n(e),k(b.$$.fragment,e),L=n(e),g=i(e,"UL",{"data-svelte-h":!0}),T(g)!=="svelte-qx2gyh"&&(g.innerHTML=N),R=n(e),y=i(e,"UL",{"data-svelte-h":!0}),T(y)!=="svelte-125l45p"&&(y.innerHTML=A),S=n(e),k(M.$$.fragment,e),Q=n(e),U=i(e,"P",{}),P(U).forEach(a),this.h()},h(){K(o,"name","hf:doc:metadata"),K(o,"content",me)},m(e,t){oe(document.head,o),s(e,j,t),s(e,J,t),s(e,v,t),w(m,e,t),s(e,H,t),s(e,p,t),s(e,C,t),s(e,u,t),s(e,x,t),s(e,c,t),s(e,W,t),w(d,e,t),s(e,z,t),s(e,h,t),s(e,B,t),w(f,e,t),s(e,I,t),w(b,e,t),s(e,L,t),s(e,g,t),s(e,R,t),s(e,y,t),s(e,S,t),w(M,e,t),s(e,Q,t),s(e,U,t),E=!0},p:te,i(e){E||(Z(m.$$.fragment,e),Z(d.$$.fragment,e),Z(f.$$.fragment,e),Z(b.$$.fragment,e),Z(M.$$.fragment,e),E=!0)},o(e){$(m.$$.fragment,e),$(d.$$.fragment,e),$(f.$$.fragment,e),$(b.$$.fragment,e),$(M.$$.fragment,e),E=!1},d(e){e&&(a(j),a(J),a(v),a(H),a(p),a(C),a(u),a(x),a(c),a(W),a(z),a(h),a(B),a(I),a(L),a(g),a(R),a(y),a(S),a(Q),a(U)),a(o),G(m,e),G(d,e),G(f,e),G(b,e),G(M,e)}}}const me='{"title":"TF-Keras (legacy)","local":"tf-keras-legacy","sections":[],"depth":2}';function pe(F){return ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fe extends se{constructor(o){super(),le(this,o,pe,ie,ee,{})}}export{fe as component};
