import{s as Ce,n as Le,o as Ue}from"../chunks/scheduler.9cda857a.js";import{S as Pe,i as Fe,e as n,s as o,c as d,h as Ke,a as s,d as l,b as i,f as He,g as m,j as r,k as pe,l as je,m as a,n as u,t as p,o as f,p as h}from"../chunks/index.003612b0.js";import{C as Je}from"../chunks/CopyLLMTxtMenu.44d08a39.js";import{C as fe}from"../chunks/CodeBlock.a90632f1.js";import{H as z,E as qe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e5cfda8c.js";function Ee(he){let g,A,W,I,$,S,b,Z,y,ge='Keras is an open-source multi-backend deep learning framework, with support for JAX, TensorFlow, and PyTorch. You can find more details about it on <a href="https://keras.io/" rel="nofollow">keras.io</a>.',V,w,X,k,ce='You can list <code>keras</code> models on the Hub by filtering by library name on the <a href="https://huggingface.co/models?library=keras&amp;sort=downloads" rel="nofollow">models page</a>.',Y,v,$e="Keras models on the Hub come up with useful features when uploaded directly from the Keras library:",R,_,be="<li>A generated model card with a description, a plot of the model, and more.</li> <li>A download count to monitor the popularity of a model.</li> <li>A code snippet to quickly get started with the model.</li>",B,T,N,M,ye="Keras is deeply integrated with the Hugging Face Hub. This means you can load and save models on the Hub directly from the library. To do that, you need to install a recent version of Keras and <code>huggingface_hub</code>. The <code>huggingface_hub</code> library is a lightweight Python client used by Keras to interact with the Hub.",O,x,Q,H,we='Once you have the library installed, you just need to use the regular <code>keras.saving.load_model</code> method by passing as argument a Hugging Face path. An HF path is a <code>repo_id</code> prefixed by <code>hf://</code> e.g. <code>&quot;hf://keras-io/weather-prediction&quot;</code>. Read more about <code>load_model</code> in <a href="https://keras.io/api/models/model_saving_apis/model_saving_and_loading/#load_model-function" rel="nofollow">Keras documentation</a>.',D,C,ee,L,ke="If you want to see how to load a specific model, you can click <strong>Use this model</strong> on the model page to get a working code snippet!",te,U,le,P,ve="Similarly to <code>load_model</code>, you can save and share a <code>keras</code> model on the Hub using <code>model.save()</code> with an HF path:",ae,F,oe,K,_e="If the repository does not exist on the Hub, it will be created for you. The uploaded model contains a model card, a plot of the model, the <code>metadata.json</code> and <code>config.json</code> files, and a <code>model.weights.h5</code> file containing the model weights.",ie,j,Te='By default, the repository will contain a minimal model card. Check out the <a href="https://huggingface.co/docs/hub/model-cards" rel="nofollow">Model Card guide</a> to learn more about model cards and how to complete them. You can also programmatically update model cards using <code>huggingface_hub.ModelCard</code> (see <a href="https://huggingface.co/docs/huggingface_hub/guides/model-cards" rel="nofollow">guide</a>).',ne,c,Me="<p>You might be already familiar with <code>.keras</code> files. In fact, a <code>.keras</code> file is simply a zip file containing the <code>.json</code> and <code>model.weights.h5</code> files. When pushed to the Hub, the model is saved as an unzipped folder in order to let you navigate through the files. Note that if you manually upload a <code>.keras</code> file to a model repository on the Hub, the repository will automatically be tagged as <code>keras</code> but you won’t be able to load it using <code>keras.saving.load_model</code>.</p>",se,J,re,q,xe='<li>Keras Developer <a href="https://keras.io/guides/" rel="nofollow">Guides</a>.</li> <li>Keras <a href="https://keras.io/examples/" rel="nofollow">examples</a>.</li>',de,E,me,G,ue;return $=new Je({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new z({props:{title:"Using Keras at Hugging Face",local:"using-keras-at-hugging-face",headingTag:"h1"}}),w=new z({props:{title:"Exploring Keras in the Hub",local:"exploring-keras-in-the-hub",headingTag:"h2"}}),T=new z({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),x=new fe({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwa2VyYXMlMjBodWdnaW5nZmFjZV9odWI=",highlighted:'pip <span class="hljs-keyword">install</span> -U keras huggingface_hub',wrap:!1}}),C=new fe({props:{code:"aW1wb3J0JTIwa2VyYXMlMEElMEFtb2RlbCUyMCUzRCUyMGtlcmFzLnNhdmluZy5sb2FkX21vZGVsKCUyMmhmJTNBJTJGJTJGV2F1cGxpbiUyRm1uaXN0X2V4YW1wbGUlMjIp",highlighted:`<span class="hljs-keyword">import</span> keras

model = keras.saving.load_model(<span class="hljs-string">&quot;hf://Wauplin/mnist_example&quot;</span>)`,wrap:!1}}),U=new z({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),F=new fe({props:{code:"bW9kZWwlMjAlM0QlMjAuLi4lMEFtb2RlbC5zYXZlKCUyMmhmJTNBJTJGJTJGeW91ci11c2VybmFtZSUyRnlvdXItbW9kZWwtbmFtZSUyMik=",highlighted:`model = ...
model.save(<span class="hljs-string">&quot;hf://your-username/your-model-name&quot;</span>)`,wrap:!1}}),J=new z({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),E=new qe({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/keras.md"}}),{c(){g=n("meta"),A=o(),W=n("p"),I=o(),d($.$$.fragment),S=o(),d(b.$$.fragment),Z=o(),y=n("p"),y.innerHTML=ge,V=o(),d(w.$$.fragment),X=o(),k=n("p"),k.innerHTML=ce,Y=o(),v=n("p"),v.textContent=$e,R=o(),_=n("ol"),_.innerHTML=be,B=o(),d(T.$$.fragment),N=o(),M=n("p"),M.innerHTML=ye,O=o(),d(x.$$.fragment),Q=o(),H=n("p"),H.innerHTML=we,D=o(),d(C.$$.fragment),ee=o(),L=n("p"),L.innerHTML=ke,te=o(),d(U.$$.fragment),le=o(),P=n("p"),P.innerHTML=ve,ae=o(),d(F.$$.fragment),oe=o(),K=n("p"),K.innerHTML=_e,ie=o(),j=n("p"),j.innerHTML=Te,ne=o(),c=n("blockquote"),c.innerHTML=Me,se=o(),d(J.$$.fragment),re=o(),q=n("ul"),q.innerHTML=xe,de=o(),d(E.$$.fragment),me=o(),G=n("p"),this.h()},l(e){const t=Ke("svelte-u9bgzb",document.head);g=s(t,"META",{name:!0,content:!0}),t.forEach(l),A=i(e),W=s(e,"P",{}),He(W).forEach(l),I=i(e),m($.$$.fragment,e),S=i(e),m(b.$$.fragment,e),Z=i(e),y=s(e,"P",{"data-svelte-h":!0}),r(y)!=="svelte-lh2if0"&&(y.innerHTML=ge),V=i(e),m(w.$$.fragment,e),X=i(e),k=s(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-v38oq2"&&(k.innerHTML=ce),Y=i(e),v=s(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-1izvrkx"&&(v.textContent=$e),R=i(e),_=s(e,"OL",{"data-svelte-h":!0}),r(_)!=="svelte-6nxkfr"&&(_.innerHTML=be),B=i(e),m(T.$$.fragment,e),N=i(e),M=s(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-1stutjb"&&(M.innerHTML=ye),O=i(e),m(x.$$.fragment,e),Q=i(e),H=s(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-1xteu3z"&&(H.innerHTML=we),D=i(e),m(C.$$.fragment,e),ee=i(e),L=s(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-it9nkr"&&(L.innerHTML=ke),te=i(e),m(U.$$.fragment,e),le=i(e),P=s(e,"P",{"data-svelte-h":!0}),r(P)!=="svelte-1rb8hx6"&&(P.innerHTML=ve),ae=i(e),m(F.$$.fragment,e),oe=i(e),K=s(e,"P",{"data-svelte-h":!0}),r(K)!=="svelte-5mekfp"&&(K.innerHTML=_e),ie=i(e),j=s(e,"P",{"data-svelte-h":!0}),r(j)!=="svelte-quc9ua"&&(j.innerHTML=Te),ne=i(e),c=s(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),r(c)!=="svelte-1l7gfqd"&&(c.innerHTML=Me),se=i(e),m(J.$$.fragment,e),re=i(e),q=s(e,"UL",{"data-svelte-h":!0}),r(q)!=="svelte-12xt5og"&&(q.innerHTML=xe),de=i(e),m(E.$$.fragment,e),me=i(e),G=s(e,"P",{}),He(G).forEach(l),this.h()},h(){pe(g,"name","hf:doc:metadata"),pe(g,"content",We),pe(c,"class","tip")},m(e,t){je(document.head,g),a(e,A,t),a(e,W,t),a(e,I,t),u($,e,t),a(e,S,t),u(b,e,t),a(e,Z,t),a(e,y,t),a(e,V,t),u(w,e,t),a(e,X,t),a(e,k,t),a(e,Y,t),a(e,v,t),a(e,R,t),a(e,_,t),a(e,B,t),u(T,e,t),a(e,N,t),a(e,M,t),a(e,O,t),u(x,e,t),a(e,Q,t),a(e,H,t),a(e,D,t),u(C,e,t),a(e,ee,t),a(e,L,t),a(e,te,t),u(U,e,t),a(e,le,t),a(e,P,t),a(e,ae,t),u(F,e,t),a(e,oe,t),a(e,K,t),a(e,ie,t),a(e,j,t),a(e,ne,t),a(e,c,t),a(e,se,t),u(J,e,t),a(e,re,t),a(e,q,t),a(e,de,t),u(E,e,t),a(e,me,t),a(e,G,t),ue=!0},p:Le,i(e){ue||(p($.$$.fragment,e),p(b.$$.fragment,e),p(w.$$.fragment,e),p(T.$$.fragment,e),p(x.$$.fragment,e),p(C.$$.fragment,e),p(U.$$.fragment,e),p(F.$$.fragment,e),p(J.$$.fragment,e),p(E.$$.fragment,e),ue=!0)},o(e){f($.$$.fragment,e),f(b.$$.fragment,e),f(w.$$.fragment,e),f(T.$$.fragment,e),f(x.$$.fragment,e),f(C.$$.fragment,e),f(U.$$.fragment,e),f(F.$$.fragment,e),f(J.$$.fragment,e),f(E.$$.fragment,e),ue=!1},d(e){e&&(l(A),l(W),l(I),l(S),l(Z),l(y),l(V),l(X),l(k),l(Y),l(v),l(R),l(_),l(B),l(N),l(M),l(O),l(Q),l(H),l(D),l(ee),l(L),l(te),l(le),l(P),l(ae),l(oe),l(K),l(ie),l(j),l(ne),l(c),l(se),l(re),l(q),l(de),l(me),l(G)),l(g),h($,e),h(b,e),h(w,e),h(T,e),h(x,e),h(C,e),h(U,e),h(F,e),h(J,e),h(E,e)}}}const We='{"title":"Using Keras at Hugging Face","local":"using-keras-at-hugging-face","sections":[{"title":"Exploring Keras in the Hub","local":"exploring-keras-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 Ge(he){return Ue(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ve extends Pe{constructor(g){super(),Fe(this,g,Ge,Ee,Ce,{})}}export{Ve as component};
