import{S as ii,i as ci,s as hi,e as n,k as h,w as f,t as l,N as ui,c as o,d as t,m as u,a as r,x as d,h as a,b as c,P as ks,G as s,g as i,y as m,L as fi,q as y,o as M,B as w,v as di}from"../chunks/vendor-hf-doc-builder.js";import{I as Y}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as g}from"../chunks/CodeBlock-hf-doc-builder.js";function mi(hr){let G,Dt,Z,L,bs,je,ma,Is,ya,Wt,R,Ma,_s,wa,ja,ge,ga,Ta,Qt,H,Ja,Te,Ua,va,Ft,V,P,Ss,Je,Ea,Rs,ka,xt,A,ba,Ue,Ia,_a,As,Sa,Ra,Xt,ve,$s,ur,qt,z,Aa,ms,$a,Ca,Yt,j,Ba,Cs,Ga,Za,Ee,Va,Na,Bs,Da,Wa,Gs,Qa,Fa,Zs,xa,Xa,Lt,ke,Ht,U,qa,Vs,Ya,La,Ns,Ha,Pa,Ds,za,Oa,Pt,be,zt,N,O,Ws,Ie,Ka,Qs,en,Ot,v,sn,Fs,tn,ln,_e,an,nn,xs,on,rn,Kt,Se,el,ys,pn,sl,D,K,Xs,Re,cn,qs,hn,tl,ee,un,Ys,fn,dn,ll,Ae,al,W,se,Ls,$e,mn,Hs,yn,nl,te,Mn,Ce,wn,jn,ol,Be,rl,le,gn,Ge,Tn,Jn,pl,Ze,Ps,fr,il,Q,ae,zs,Ve,Un,Os,vn,cl,S,Ks,En,kn,et,bn,In,st,_n,Sn,hl,Ne,ul,$,Rn,Ms,An,$n,tt,Cn,Bn,fl,De,dl,ne,Gn,lt,Zn,Vn,ml,We,yl,F,oe,at,Qe,Nn,nt,Dn,Ml,E,Wn,ot,Qn,Fn,rt,xn,Xn,pt,qn,Yn,wl,Fe,jl,re,Ln,xe,Hn,Pn,gl,ws,it,zn,Tl,T,On,ct,Kn,eo,ht,so,to,Xe,lo,ao,ut,no,oo,Jl,qe,Ul,Ye,Le,ro,ft,po,io,vl,He,El,Pe,ze,co,dt,ho,uo,kl,Oe,bl,Ke,es,fo,mt,mo,yo,Il,ss,_l,ts,yt,Mo,Sl,J,wo,js,jo,go,Mt,To,Jo,wt,Uo,vo,jt,Eo,ko,Rl,ls,Al,pe,bo,gt,Io,_o,$l,as,Cl,ie,So,ns,Ro,Ao,Bl,os,Tt,dr,Gl,k,$o,rs,Co,Bo,ps,Go,Zo,gs,Vo,No,Zl,x,ce,Jt,is,Do,Ut,Wo,Vl,b,Qo,vt,Fo,xo,Et,Xo,qo,kt,Yo,Lo,Nl,cs,bt,mr,Dl,I,Ho,It,Po,zo,_t,Oo,Ko,St,er,sr,Wl,hs,Rt,yr,Ql,X,tr,At,lr,ar,$t,nr,Fl,us,Ct,Mr,xl,q,he,Bt,fs,or,Gt,rr,Xl,ue,Zt,Ts,pr,ir,Vt,Js,cr,ql;return je=new Y({}),Je=new Y({}),ke=new g({props:{code:"c2RrJTNBJTIwZG9ja2Vy",highlighted:'<span class="hljs-attr">sdk:</span> <span class="hljs-string">docker</span>'}}),be=new g({props:{code:"YXBwX3BvcnQlM0ElMjA3ODYw",highlighted:'<span class="hljs-attr">app_port:</span> <span class="hljs-number">7860</span>'}}),Ie=new Y({}),Se=new g({props:{code:"ZmFzdGFwaSUzRCUzRDAuNzQuKiUwQXJlcXVlc3RzJTNEJTNEMi4yNy4qJTBBc2VudGVuY2VwaWVjZSUzRCUzRDAuMS4qJTBBdG9yY2glM0QlM0QxLjExLiolMEF0cmFuc2Zvcm1lcnMlM0QlM0Q0LiolMEF1dmljb3JuJTVCc3RhbmRhcmQlNUQlM0QlM0QwLjE3Lio=",highlighted:`<span class="hljs-attribute">fastapi</span><span class="hljs-operator">=</span><span class="hljs-operator">=</span><span class="hljs-number">0.74</span>.*
<span class="hljs-attribute">requests</span><span class="hljs-operator">=</span><span class="hljs-operator">=</span><span class="hljs-number">2.27</span>.*
<span class="hljs-attribute">sentencepiece</span><span class="hljs-operator">=</span><span class="hljs-operator">=</span><span class="hljs-number">0.1</span>.*
<span class="hljs-attribute">torch</span><span class="hljs-operator">=</span><span class="hljs-operator">=</span><span class="hljs-number">1.11</span>.*
<span class="hljs-attribute">transformers</span><span class="hljs-operator">=</span><span class="hljs-operator">=</span><span class="hljs-number">4</span>.*
uvicorn[standard]<span class="hljs-operator">=</span><span class="hljs-operator">=</span><span class="hljs-number">0.17</span>.*`}}),Re=new Y({}),Ae=new g({props:{code:"ZnJvbSUyMGZhc3RhcGklMjBpbXBvcnQlMjBGYXN0QVBJJTBBJTBBYXBwJTIwJTNEJTIwRmFzdEFQSSgpJTBBJTBBJTQwYXBwLmdldCglMjIlMkYlMjIpJTBBZGVmJTIwcmVhZF9yb290KCklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0IlMjJIZWxsbyUyMiUzQSUyMCUyMldvcmxkISUyMiU3RA==",highlighted:`<span class="hljs-keyword">from</span> fastapi <span class="hljs-keyword">import</span> FastAPI

app = FastAPI()

<span class="hljs-meta">@app.get(<span class="hljs-params"><span class="hljs-string">&quot;/&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">read_root</span>():
    <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;Hello&quot;</span>: <span class="hljs-string">&quot;World!&quot;</span>}`}}),$e=new Y({}),Be=new g({props:{code:"RlJPTSUyMHB5dGhvbiUzQTMuOSUwQSUwQVdPUktESVIlMjAlMkZjb2RlJTBBJTBBQ09QWSUyMC4lMkZyZXF1aXJlbWVudHMudHh0JTIwJTJGY29kZSUyRnJlcXVpcmVtZW50cy50eHQlMEElMEFSVU4lMjBwaXAlMjBpbnN0YWxsJTIwLS1uby1jYWNoZS1kaXIlMjAtLXVwZ3JhZGUlMjAtciUyMCUyRmNvZGUlMkZyZXF1aXJlbWVudHMudHh0JTBBJTBBQ09QWSUyMC4lMjAuJTBBJTBBQ01EJTIwJTVCJTIydXZpY29ybiUyMiUyQyUyMCUyMm1haW4lM0FhcHAlMjIlMkMlMjAlMjItLWhvc3QlMjIlMkMlMjAlMjIwLjAuMC4wJTIyJTJDJTIwJTIyLS1wb3J0JTIyJTJDJTIwJTIyNzg2MCUyMiU1RCUwQQ==",highlighted:`<span class="hljs-keyword">FROM</span> python:<span class="hljs-number">3.9</span>

<span class="hljs-keyword">WORKDIR</span><span class="language-bash"> /code</span>

<span class="hljs-keyword">COPY</span><span class="language-bash"> ./requirements.txt /code/requirements.txt</span>

<span class="hljs-keyword">RUN</span><span class="language-bash"> pip install --no-cache-dir --upgrade -r /code/requirements.txt</span>

<span class="hljs-keyword">COPY</span><span class="language-bash"> . .</span>

<span class="hljs-keyword">CMD</span><span class="language-bash"> [<span class="hljs-string">&quot;uvicorn&quot;</span>, <span class="hljs-string">&quot;main:app&quot;</span>, <span class="hljs-string">&quot;--host&quot;</span>, <span class="hljs-string">&quot;0.0.0.0&quot;</span>, <span class="hljs-string">&quot;--port&quot;</span>, <span class="hljs-string">&quot;7860&quot;</span>]</span>
`}}),Ve=new Y({}),Ne=new g({props:{code:"ZG9ja2VyJTIwYnVpbGQlMjAtdCUyMGZhc3RhcGklMjAuJTBBZG9ja2VyJTIwcnVuJTIwJTIwLWl0JTIwLXAlMjA3ODYwJTNBNzg2MCUyMGZhc3RhcGk=",highlighted:`docker build -t fastapi .
docker run  -it -p 7860:7860 fastapi`}}),De=new g({props:{code:"ZXhwb3J0JTIwU0VDUkVUX0VYQU1QTEUlM0QlMjJteV9zZWNyZXRfdmFsdWUlMjIlMEFkb2NrZXIlMjBidWlsZHglMjBidWlsZCUyMC0tc2VjcmV0JTIwaWQlM0RTRUNSRVRfRVhBTVBMRSUyQ2VudiUzRFNFQ1JFVF9FWEFNUExFJTIwLXQlMjBmYXN0YXBpJTIwLg==",highlighted:`<span class="hljs-built_in">export</span> SECRET_EXAMPLE=<span class="hljs-string">&quot;my_secret_value&quot;</span>
docker buildx build --secret <span class="hljs-built_in">id</span>=SECRET_EXAMPLE,<span class="hljs-built_in">env</span>=SECRET_EXAMPLE -t fastapi .`}}),We=new g({props:{code:"ZXhwb3J0JTIwU0VDUkVUX0VYQU1QTEUlM0QlMjJteV9zZWNyZXRfdmFsdWUlMjIlMEFkb2NrZXIlMjBydW4lMjAtaXQlMjAtcCUyMDc4NjAlM0E3ODYwJTIwLWUlMjBTRUNSRVRfRVhBTVBMRSUzRCUyNFNFQ1JFVF9FWEFNUExFJTIwZmFzdGFwaQ==",highlighted:`<span class="hljs-built_in">export</span> SECRET_EXAMPLE=<span class="hljs-string">&quot;my_secret_value&quot;</span>
docker run -it -p 7860:7860 -e SECRET_EXAMPLE=<span class="hljs-variable">$SECRET_EXAMPLE</span> fastapi`}}),Qe=new Y({}),Fe=new g({props:{code:"JTJGc3RhdGljJTBBJTJGc3RhdGljJTJGaW5kZXguaHRtbCUwQSUyRnN0YXRpYyUyRnNjcmlwdC5qcyUwQSUyRnN0YXRpYyUyRnN0eWxlLmNzcyUwQURvY2tlcmZpbGUlMEFtYWluLnB5JTBBUkVBRE1FLm1kJTBBcmVxdWlyZW1lbnRzLnR4dA==",highlighted:`/static
/static/index.html
/static/script.js
/static/style.css
Dockerfile
main.py
README.md
requirements.txt`}}),qe=new g({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcGlwZV9mbGFuJTIwJTNEJTIwcGlwZWxpbmUoJTIydGV4dDJ0ZXh0LWdlbmVyYXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMmdvb2dsZSUyRmZsYW4tdDUtc21hbGwlMjIpJTBBJTBBJTQwYXBwLmdldCglMjIlMkZpbmZlcl90NSUyMiklMEFkZWYlMjB0NShpbnB1dCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXQlMjAlM0QlMjBwaXBlX2ZsYW4oaW5wdXQpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJTIyb3V0cHV0JTIyJTNBJTIwb3V0cHV0JTVCMCU1RCU1QiUyMmdlbmVyYXRlZF90ZXh0JTIyJTVEJTdE",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipe_flan = pipeline(<span class="hljs-string">&quot;text2text-generation&quot;</span>, model=<span class="hljs-string">&quot;google/flan-t5-small&quot;</span>)

<span class="hljs-meta">@app.get(<span class="hljs-params"><span class="hljs-string">&quot;/infer_t5&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">t5</span>(<span class="hljs-params"><span class="hljs-built_in">input</span></span>):
    output = pipe_flan(<span class="hljs-built_in">input</span>)
    <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;output&quot;</span>: output[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;generated_text&quot;</span>]}`}}),He=new g({props:{code:"JTNDbWFpbiUzRSUwQSUyMCUyMCUzQ3NlY3Rpb24lMjBpZCUzRCUyMnRleHQtZ2VuJTIyJTNFJTBBJTIwJTIwJTIwJTIwJTNDaDIlM0VUZXh0JTIwZ2VuZXJhdGlvbiUyMHVzaW5nJTIwRmxhbiUyMFQ1JTNDJTJGaDIlM0UlMEElMjAlMjAlMjAlMjAlM0NwJTNFJTBBJTIwJTIwJTIwJTIwJTIwJTIwTW9kZWwlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlM0NhJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaHJlZiUzRCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZnb29nbGUlMkZmbGFuLXQ1LXNtYWxsJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmVsJTNEJTIybm9yZWZlcnJlciUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHRhcmdldCUzRCUyMl9ibGFuayUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUzRWdvb2dsZSUyRmZsYW4tdDUtc21hbGwlMEElMjAlMjAlMjAlMjAlMjAlMjAlM0MlMkZhJTNFJTBBJTIwJTIwJTIwJTIwJTNDJTJGcCUzRSUwQSUyMCUyMCUyMCUyMCUzQ2Zvcm0lMjBjbGFzcyUzRCUyMnRleHQtZ2VuLWZvcm0lMjIlM0UlMEElMjAlMjAlMjAlMjAlMjAlMjAlM0NsYWJlbCUyMGZvciUzRCUyMnRleHQtZ2VuLWlucHV0JTIyJTNFVGV4dCUyMHByb21wdCUzQyUyRmxhYmVsJTNFJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTNDaW5wdXQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZCUzRCUyMnRleHQtZ2VuLWlucHV0JTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdHlwZSUzRCUyMnRleHQlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB2YWx1ZSUzRCUyMkdlcm1hbiUzQSUyMFRoZXJlJTIwYXJlJTIwbWFueSUyMGR1Y2tzJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTJGJTNFJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTNDYnV0dG9uJTIwaWQlM0QlMjJ0ZXh0LWdlbi1zdWJtaXQlMjIlM0VTdWJtaXQlM0MlMkZidXR0b24lM0UlMEElMjAlMjAlMjAlMjAlMjAlMjAlM0NwJTIwY2xhc3MlM0QlMjJ0ZXh0LWdlbi1vdXRwdXQlMjIlM0UlM0MlMkZwJTNFJTBBJTIwJTIwJTIwJTIwJTNDJTJGZm9ybSUzRSUwQSUyMCUyMCUzQyUyRnNlY3Rpb24lM0UlMEElM0MlMkZtYWluJTNF",highlighted:`<span class="hljs-tag">&lt;<span class="hljs-name">main</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;text-gen&quot;</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Text generation using Flan T5<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>
      Model:
      <span class="hljs-tag">&lt;<span class="hljs-name">a</span>
        <span class="hljs-attr">href</span>=<span class="hljs-string">&quot;https://huggingface.co/google/flan-t5-small&quot;</span>
        <span class="hljs-attr">rel</span>=<span class="hljs-string">&quot;noreferrer&quot;</span>
        <span class="hljs-attr">target</span>=<span class="hljs-string">&quot;_blank&quot;</span>
        &gt;</span>google/flan-t5-small
      <span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;text-gen-form&quot;</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">label</span> <span class="hljs-attr">for</span>=<span class="hljs-string">&quot;text-gen-input&quot;</span>&gt;</span>Text prompt<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span>
        <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;text-gen-input&quot;</span>
        <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;text&quot;</span>
        <span class="hljs-attr">value</span>=<span class="hljs-string">&quot;German: There are many ducks&quot;</span>
      /&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;text-gen-submit&quot;</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>=<span class="hljs-string">&quot;text-gen-output&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">main</span>&gt;</span>`}}),Oe=new g({props:{code:"YXBwLm1vdW50KCUyMiUyRiUyMiUyQyUyMFN0YXRpY0ZpbGVzKGRpcmVjdG9yeSUzRCUyMnN0YXRpYyUyMiUyQyUyMGh0bWwlM0RUcnVlKSUyQyUyMG5hbWUlM0QlMjJzdGF0aWMlMjIpJTBBJTBBJTQwYXBwLmdldCglMjIlMkYlMjIpJTBBZGVmJTIwaW5kZXgoKSUyMC0lM0UlMjBGaWxlUmVzcG9uc2UlM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjBGaWxlUmVzcG9uc2UocGF0aCUzRCUyMiUyRmFwcCUyRnN0YXRpYyUyRmluZGV4Lmh0bWwlMjIlMkMlMjBtZWRpYV90eXBlJTNEJTIydGV4dCUyRmh0bWwlMjIp",highlighted:`app.mount(<span class="hljs-string">&quot;/&quot;</span>, StaticFiles(directory=<span class="hljs-string">&quot;static&quot;</span>, html=<span class="hljs-literal">True</span>), name=<span class="hljs-string">&quot;static&quot;</span>)

<span class="hljs-meta">@app.get(<span class="hljs-params"><span class="hljs-string">&quot;/&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">index</span>() -&gt; FileResponse:
    <span class="hljs-keyword">return</span> FileResponse(path=<span class="hljs-string">&quot;/app/static/index.html&quot;</span>, media_type=<span class="hljs-string">&quot;text/html&quot;</span>)`}}),ss=new g({props:{code:"Y29uc3QlMjB0ZXh0R2VuRm9ybSUyMCUzRCUyMGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJTIyLnRleHQtZ2VuLWZvcm0lMjIpJTNCJTBBJTBBY29uc3QlMjB0cmFuc2xhdGVUZXh0JTIwJTNEJTIwYXN5bmMlMjAodGV4dCklMjAlM0QlM0UlMjAlN0IlMEElMjAlMjBjb25zdCUyMGluZmVyUmVzcG9uc2UlMjAlM0QlMjBhd2FpdCUyMGZldGNoKCU2MGluZmVyX3Q1JTNGaW5wdXQlM0QlMjQlN0J0ZXh0JTdEJTYwKSUzQiUwQSUyMCUyMGNvbnN0JTIwaW5mZXJKc29uJTIwJTNEJTIwYXdhaXQlMjBpbmZlclJlc3BvbnNlLmpzb24oKSUzQiUwQSUwQSUyMCUyMHJldHVybiUyMGluZmVySnNvbi5vdXRwdXQlM0IlMEElN0QlM0IlMEElMEF0ZXh0R2VuRm9ybS5hZGRFdmVudExpc3RlbmVyKCUyMnN1Ym1pdCUyMiUyQyUyMGFzeW5jJTIwKGV2ZW50KSUyMCUzRCUzRSUyMCU3QiUwQSUyMCUyMGV2ZW50LnByZXZlbnREZWZhdWx0KCklM0IlMEElMEElMjAlMjBjb25zdCUyMHRleHRHZW5JbnB1dCUyMCUzRCUyMGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCUyMnRleHQtZ2VuLWlucHV0JTIyKSUzQiUwQSUyMCUyMGNvbnN0JTIwdGV4dEdlblBhcmFncmFwaCUyMCUzRCUyMGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJTIyLnRleHQtZ2VuLW91dHB1dCUyMiklM0IlMEElMEElMjAlMjB0ZXh0R2VuUGFyYWdyYXBoLnRleHRDb250ZW50JTIwJTNEJTIwYXdhaXQlMjB0cmFuc2xhdGVUZXh0KHRleHRHZW5JbnB1dC52YWx1ZSklM0IlMEElN0QpJTNC",highlighted:`<span class="hljs-keyword">const</span> textGenForm = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">querySelector</span>(<span class="hljs-string">&quot;.text-gen-form&quot;</span>);

<span class="hljs-keyword">const</span> <span class="hljs-title function_">translateText</span> = <span class="hljs-keyword">async</span> (<span class="hljs-params">text</span>) =&gt; {
  <span class="hljs-keyword">const</span> inferResponse = <span class="hljs-keyword">await</span> <span class="hljs-title function_">fetch</span>(<span class="hljs-string">\`infer_t5?input=<span class="hljs-subst">\${text}</span>\`</span>);
  <span class="hljs-keyword">const</span> inferJson = <span class="hljs-keyword">await</span> inferResponse.<span class="hljs-title function_">json</span>();

  <span class="hljs-keyword">return</span> inferJson.<span class="hljs-property">output</span>;
};

textGenForm.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">&quot;submit&quot;</span>, <span class="hljs-keyword">async</span> (event) =&gt; {
  event.<span class="hljs-title function_">preventDefault</span>();

  <span class="hljs-keyword">const</span> textGenInput = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">&quot;text-gen-input&quot;</span>);
  <span class="hljs-keyword">const</span> textGenParagraph = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">querySelector</span>(<span class="hljs-string">&quot;.text-gen-output&quot;</span>);

  textGenParagraph.<span class="hljs-property">textContent</span> = <span class="hljs-keyword">await</span> <span class="hljs-title function_">translateText</span>(textGenInput.<span class="hljs-property">value</span>);
});`}}),ls=new g({props:{code:"JTIzJTIwU2V0JTIwdXAlMjBhJTIwbmV3JTIwdXNlciUyMG5hbWVkJTIwJTIydXNlciUyMiUyMHdpdGglMjB1c2VyJTIwSUQlMjAxMDAwJTBBUlVOJTIwdXNlcmFkZCUyMC1tJTIwLXUlMjAxMDAwJTIwdXNlciUwQSUwQSUyMyUyMFN3aXRjaCUyMHRvJTIwdGhlJTIwJTIydXNlciUyMiUyMHVzZXIlMEFVU0VSJTIwdXNlciUwQSUwQSUyMyUyMFNldCUyMGhvbWUlMjB0byUyMHRoZSUyMHVzZXIncyUyMGhvbWUlMjBkaXJlY3RvcnklMEFFTlYlMjBIT01FJTNEJTJGaG9tZSUyRnVzZXIlMjAlNUMlMEElMDlQQVRIJTNEJTJGaG9tZSUyRnVzZXIlMkYubG9jYWwlMkZiaW4lM0ElMjRQQVRIJTBBJTBBJTIzJTIwU2V0JTIwdGhlJTIwd29ya2luZyUyMGRpcmVjdG9yeSUyMHRvJTIwdGhlJTIwdXNlcidzJTIwaG9tZSUyMGRpcmVjdG9yeSUwQVdPUktESVIlMjAlMjRIT01FJTJGYXBwJTBBJTBBJTIzJTIwQ29weSUyMHRoZSUyMGN1cnJlbnQlMjBkaXJlY3RvcnklMjBjb250ZW50cyUyMGludG8lMjB0aGUlMjBjb250YWluZXIlMjBhdCUyMCUyNEhPTUUlMkZhcHAlMjBzZXR0aW5nJTIwdGhlJTIwb3duZXIlMjB0byUyMHRoZSUyMHVzZXIlMEFDT1BZJTIwLS1jaG93biUzRHVzZXIlMjAuJTIwJTI0SE9NRSUyRmFwcA==",highlighted:`<span class="hljs-comment"># Set up a new user named &quot;user&quot; with user ID 1000</span>
<span class="hljs-keyword">RUN</span><span class="language-bash"> useradd -m -u 1000 user</span>

<span class="hljs-comment"># Switch to the &quot;user&quot; user</span>
<span class="hljs-keyword">USER</span> <span class="hljs-keyword">user</span>

<span class="hljs-comment"># Set home to the user&#x27;s home directory</span>
<span class="hljs-keyword">ENV</span> HOME=/home/<span class="hljs-keyword">user</span> \\
	PATH=/home/<span class="hljs-keyword">user</span>/.local/bin:$PATH

<span class="hljs-comment"># Set the working directory to the user&#x27;s home directory</span>
<span class="hljs-keyword">WORKDIR</span><span class="language-bash"> <span class="hljs-variable">$HOME</span>/app</span>

<span class="hljs-comment"># Copy the current directory contents into the container at $HOME/app setting the owner to the user</span>
<span class="hljs-keyword">COPY</span><span class="language-bash"> --<span class="hljs-built_in">chown</span>=user . <span class="hljs-variable">$HOME</span>/app</span>`}}),as=new g({props:{code:"RlJPTSUyMHB5dGhvbiUzQTMuOSUwQSUwQVdPUktESVIlMjAlMkZjb2RlJTBBJTBBQ09QWSUyMC4lMkZyZXF1aXJlbWVudHMudHh0JTIwJTJGY29kZSUyRnJlcXVpcmVtZW50cy50eHQlMEElMEFSVU4lMjBwaXAlMjBpbnN0YWxsJTIwLS1uby1jYWNoZS1kaXIlMjAtLXVwZ3JhZGUlMjAtciUyMCUyRmNvZGUlMkZyZXF1aXJlbWVudHMudHh0JTBBJTBBUlVOJTIwdXNlcmFkZCUyMC1tJTIwLXUlMjAxMDAwJTIwdXNlciUwQSUwQVVTRVIlMjB1c2VyJTBBJTBBRU5WJTIwSE9NRSUzRCUyRmhvbWUlMkZ1c2VyJTIwJTVDJTBBJTA5UEFUSCUzRCUyRmhvbWUlMkZ1c2VyJTJGLmxvY2FsJTJGYmluJTNBJTI0UEFUSCUwQSUwQVdPUktESVIlMjAlMjRIT01FJTJGYXBwJTBBJTBBQ09QWSUyMC0tY2hvd24lM0R1c2VyJTIwLiUyMCUyNEhPTUUlMkZhcHAlMEElMEFDTUQlMjAlNUIlMjJ1dmljb3JuJTIyJTJDJTIwJTIybWFpbiUzQWFwcCUyMiUyQyUyMCUyMi0taG9zdCUyMiUyQyUyMCUyMjAuMC4wLjAlMjIlMkMlMjAlMjItLXBvcnQlMjIlMkMlMjAlMjI3ODYwJTIyJTVE",highlighted:`<span class="hljs-keyword">FROM</span> python:<span class="hljs-number">3.9</span>

<span class="hljs-keyword">WORKDIR</span><span class="language-bash"> /code</span>

<span class="hljs-keyword">COPY</span><span class="language-bash"> ./requirements.txt /code/requirements.txt</span>

<span class="hljs-keyword">RUN</span><span class="language-bash"> pip install --no-cache-dir --upgrade -r /code/requirements.txt</span>

<span class="hljs-keyword">RUN</span><span class="language-bash"> useradd -m -u 1000 user</span>

<span class="hljs-keyword">USER</span> <span class="hljs-keyword">user</span>

<span class="hljs-keyword">ENV</span> HOME=/home/<span class="hljs-keyword">user</span> \\
	PATH=/home/<span class="hljs-keyword">user</span>/.local/bin:$PATH

<span class="hljs-keyword">WORKDIR</span><span class="language-bash"> <span class="hljs-variable">$HOME</span>/app</span>

<span class="hljs-keyword">COPY</span><span class="language-bash"> --<span class="hljs-built_in">chown</span>=user . <span class="hljs-variable">$HOME</span>/app</span>

<span class="hljs-keyword">CMD</span><span class="language-bash"> [<span class="hljs-string">&quot;uvicorn&quot;</span>, <span class="hljs-string">&quot;main:app&quot;</span>, <span class="hljs-string">&quot;--host&quot;</span>, <span class="hljs-string">&quot;0.0.0.0&quot;</span>, <span class="hljs-string">&quot;--port&quot;</span>, <span class="hljs-string">&quot;7860&quot;</span>]</span>`}}),is=new Y({}),fs=new Y({}),{c(){G=n("meta"),Dt=h(),Z=n("h1"),L=n("a"),bs=n("span"),f(je.$$.fragment),ma=h(),Is=n("span"),ya=l("Your First Docker Space: Text Generation with T5"),Wt=h(),R=n("p"),Ma=l("In the following sections, you\u2019ll learn the basics of creating a Docker Space, configuring it, and deploying your code to it. We\u2019ll create a "),_s=n("strong"),wa=l("Text Generation"),ja=l(" Space with Docker that\u2019ll be used to demo the "),ge=n("a"),ga=l("google/flan-t5-small"),Ta=l(" model, which can generate text given some input text, using FastAPI as the server."),Qt=h(),H=n("p"),Ja=l("You can find a completed version of this hosted "),Te=n("a"),Ua=l("here"),va=l("."),Ft=h(),V=n("h2"),P=n("a"),Ss=n("span"),f(Je.$$.fragment),Ea=h(),Rs=n("span"),ka=l("Create a new Docker Space"),xt=h(),A=n("p"),ba=l("We\u2019ll start by "),Ue=n("a"),Ia=l("creating a brand new Space"),_a=l(" and choosing "),As=n("strong"),Sa=l("Docker"),Ra=l(" as our SDK."),Xt=h(),ve=n("div"),$s=n("img"),qt=h(),z=n("p"),Aa=l("Hugging Face Spaces are Git repositories, meaning that you can work on your Space incrementally (and collaboratively) by pushing commits. Take a look at the "),ms=n("a"),$a=l("Getting Started with Repositories"),Ca=l(" guide to learn about how you can create and edit files before continuing. If you prefer to work with a UI, you can also do the work directly in the browser."),Yt=h(),j=n("p"),Ba=l("Selecting "),Cs=n("strong"),Ga=l("Docker"),Za=l(" as the SDK when "),Ee=n("a"),Va=l("creating a new Space"),Na=l(" will initialize your Docker Space by setting the "),Bs=n("code"),Da=l("sdk"),Wa=l(" property to "),Gs=n("code"),Qa=l("docker"),Fa=l(" in your "),Zs=n("code"),xa=l("README.md"),Xa=l(" file\u2019s YAML block."),Lt=h(),f(ke.$$.fragment),Ht=h(),U=n("p"),qa=l("You have the option to change the default application port of your Space by setting the "),Vs=n("code"),Ya=l("app_port"),La=l(" property in your "),Ns=n("code"),Ha=l("README.md"),Pa=l(" file\u2019s YAML block. The default port is "),Ds=n("code"),za=l("7860"),Oa=l("."),Pt=h(),f(be.$$.fragment),zt=h(),N=n("h2"),O=n("a"),Ws=n("span"),f(Ie.$$.fragment),Ka=h(),Qs=n("span"),en=l("Add the dependencies"),Ot=h(),v=n("p"),sn=l("For the "),Fs=n("strong"),tn=l("Text Generation"),ln=l(" Space, we\u2019ll be building a FastAPI app that showcases a text generation model called Flan T5. For the model inference, we\u2019ll be using a "),_e=n("a"),an=l("\u{1F917} Transformers pipeline"),nn=l(" to use the model. We need to start by installing a few dependencies. This can be done by creating a "),xs=n("strong"),on=l("requirements.txt"),rn=l(" file in our repository, and adding the following dependencies to it:"),Kt=h(),f(Se.$$.fragment),el=h(),ys=n("p"),pn=l("These dependencies will be installed in the Dockerfile we\u2019ll create later."),sl=h(),D=n("h2"),K=n("a"),Xs=n("span"),f(Re.$$.fragment),cn=h(),qs=n("span"),hn=l("Create the app"),tl=h(),ee=n("p"),un=l("Let\u2019s kick off the process with a dummy FastAPI app to see that we can get an endpoint working. The first step is to create an app file, in this case, we\u2019ll call it "),Ys=n("code"),fn=l("main.py"),dn=l("."),ll=h(),f(Ae.$$.fragment),al=h(),W=n("h2"),se=n("a"),Ls=n("span"),f($e.$$.fragment),mn=h(),Hs=n("span"),yn=l("Create the Dockerfile"),nl=h(),te=n("p"),Mn=l("The main step for a Docker Space is creating a Dockerfile. You can read more about Dockerfiles "),Ce=n("a"),wn=l("here"),jn=l(". Although we\u2019re using FastAPI in this tutorial, Dockerfiles give great flexibility to users allowing you to build a new generation of ML demos. Let\u2019s write the Dockerfile for our application"),ol=h(),f(Be.$$.fragment),rl=h(),le=n("p"),gn=l("When the changes are saved, the Space will rebuild and your demo should be up after a couple of seconds! "),Ge=n("a"),Tn=l("Here"),Jn=l(" is an example result at this point."),pl=h(),Ze=n("div"),Ps=n("img"),il=h(),Q=n("h3"),ae=n("a"),zs=n("span"),f(Ve.$$.fragment),Un=h(),Os=n("span"),vn=l("Testing locally"),cl=h(),S=n("p"),Ks=n("strong"),En=l("Tip for power users (you can skip):"),kn=l(" If you\u2019re developing locally, this is a good moment in which you can do "),et=n("code"),bn=l("docker build"),In=l(" and "),st=n("code"),_n=l("docker run"),Sn=l(" to debug locally, but it\u2019s even easier to push the changes to the Hub and see how it looks like!"),hl=h(),f(Ne.$$.fragment),ul=h(),$=n("p"),Rn=l("If you have "),Ms=n("a"),An=l("Secrets"),$n=l(" you can use "),tt=n("code"),Cn=l("docker buildx"),Bn=l(" and pass the secrets as build arguments"),fl=h(),f(De.$$.fragment),dl=h(),ne=n("p"),Gn=l("and run with "),lt=n("code"),Zn=l("docker run"),Vn=l(" passing the secrets as environment variables"),ml=h(),f(We.$$.fragment),yl=h(),F=n("h2"),oe=n("a"),at=n("span"),f(Qe.$$.fragment),Nn=h(),nt=n("span"),Dn=l("Adding some ML to our app"),Ml=h(),E=n("p"),Wn=l("As mentioned before, the idea is to use a Flan T5 model for text generation. We\u2019ll want to add some HTML and CSS for an input field, so let\u2019s create a directory called static with "),ot=n("code"),Qn=l("index.html"),Fn=l(", "),rt=n("code"),xn=l("style.css"),Xn=l(", and "),pt=n("code"),qn=l("script.js"),Yn=l(" files. At this moment, your file structure should look like this:"),wl=h(),f(Fe.$$.fragment),jl=h(),re=n("p"),Ln=l("Let\u2019s go through all the steps to make this working. We\u2019ll skip some of the details of the CSS and HTML. You can find the whole code in the Files and versions tab of the "),xe=n("a"),Hn=l("DockerTemplates/fastapi_t5"),Pn=l(" Space."),gl=h(),ws=n("ol"),it=n("li"),zn=l("Write the FastAPI endpoint to do inference"),Tl=h(),T=n("p"),On=l("We\u2019ll use the "),ct=n("code"),Kn=l("pipeline"),eo=l(" from "),ht=n("code"),so=l("transformers"),to=l(" to load the "),Xe=n("a"),lo=l("google/flan-t5-small"),ao=l(" model. We\u2019ll set an endpoint called "),ut=n("code"),no=l("infer_t5"),oo=l(" that receives and input and outputs the result of the inference call"),Jl=h(),f(qe.$$.fragment),Ul=h(),Ye=n("ol"),Le=n("li"),ro=l("Write the "),ft=n("code"),po=l("index.html"),io=l(" to have a simple form containing the code of the page."),vl=h(),f(He.$$.fragment),El=h(),Pe=n("ol"),ze=n("li"),co=l("In the "),dt=n("code"),ho=l("app.py"),uo=l(" file, mount the static files and show the html file in the root route"),kl=h(),f(Oe.$$.fragment),bl=h(),Ke=n("ol"),es=n("li"),fo=l("In the "),mt=n("code"),mo=l("script.js"),yo=l(" file, make it handle the request"),Il=h(),f(ss.$$.fragment),_l=h(),ts=n("ol"),yt=n("li"),Mo=l("Grant permissions to the right directories"),Sl=h(),J=n("p"),wo=l("As discussed in the "),js=n("a"),jo=l("Permissions Section"),go=l(", the container runs with user ID 1000. That means that the Space might face permission issues. For example, "),Mt=n("code"),To=l("transformers"),Jo=l(" downloads and caches the models in the path under the "),wt=n("code"),Uo=l("HUGGINGFACE_HUB_CACHE"),vo=l(" path. The easiest way to solve this is to create a user with righ permissions and use it to run the container application. We can do this by adding the following lines to the "),jt=n("code"),Eo=l("Dockerfile"),ko=l("."),Rl=h(),f(ls.$$.fragment),Al=h(),pe=n("p"),bo=l("The final "),gt=n("code"),Io=l("Dockerfile"),_o=l(" should look like this:"),$l=h(),f(as.$$.fragment),Cl=h(),ie=n("p"),So=l("Success! Your app should be working now! Check out "),ns=n("a"),Ro=l("DockerTemplates/fastapi_t5"),Ao=l(" to see the final result."),Bl=h(),os=n("div"),Tt=n("img"),Gl=h(),k=n("p"),$o=l("What a journey! Please remember that Docker Spaces give you lots of freedom, so you\u2019re not limited to use FastAPI. From a "),rs=n("a"),Co=l("Go Endpoint"),Bo=l(" to a "),ps=n("a"),Go=l("Shiny App"),Zo=l(", the limit is the moon! Check out "),gs=n("a"),Vo=l("some official examples"),No=l(". You can also upgrade your Space to a GPU if needed \u{1F603}"),Zl=h(),x=n("h2"),ce=n("a"),Jt=n("span"),f(is.$$.fragment),Do=h(),Ut=n("span"),Wo=l("Debugging"),Vl=h(),b=n("p"),Qo=l("You can debug your Space by checking the "),vt=n("strong"),Fo=l("Build"),xo=l(" and "),Et=n("strong"),Xo=l("Container"),qo=l(" logs. Click on the "),kt=n("strong"),Yo=l("Open Logs"),Lo=l(" button to open the modal."),Nl=h(),cs=n("div"),bt=n("img"),Dl=h(),I=n("p"),Ho=l("If everything went well, you will see "),It=n("code"),Po=l("Pushing Image"),zo=l(" and "),_t=n("code"),Oo=l("Scheduling Space"),Ko=l(" on the "),St=n("strong"),er=l("Build"),sr=l(" tab"),Wl=h(),hs=n("div"),Rt=n("img"),Ql=h(),X=n("p"),tr=l("On the "),At=n("strong"),lr=l("Container"),ar=l(" tab, you will see the application status, in this case, "),$t=n("code"),nr=l("Uvicorn running on http://0.0.0.0:7860"),Fl=h(),us=n("div"),Ct=n("img"),xl=h(),q=n("h2"),he=n("a"),Bt=n("span"),f(fs.$$.fragment),or=h(),Gt=n("span"),rr=l("Read More"),Xl=h(),ue=n("ul"),Zt=n("li"),Ts=n("a"),pr=l("Docker Spaces"),ir=h(),Vt=n("li"),Js=n("a"),cr=l("List of Docker Spaces examples"),this.h()},l(e){const p=ui('[data-svelte="svelte-1phssyn"]',document.head);G=o(p,"META",{name:!0,content:!0}),p.forEach(t),Dt=u(e),Z=o(e,"H1",{class:!0});var Yl=r(Z);L=o(Yl,"A",{id:!0,class:!0,href:!0});var wr=r(L);bs=o(wr,"SPAN",{});var jr=r(bs);d(je.$$.fragment,jr),jr.forEach(t),wr.forEach(t),ma=u(Yl),Is=o(Yl,"SPAN",{});var gr=r(Is);ya=a(gr,"Your First Docker Space: Text Generation with T5"),gr.forEach(t),Yl.forEach(t),Wt=u(e),R=o(e,"P",{});var Us=r(R);Ma=a(Us,"In the following sections, you\u2019ll learn the basics of creating a Docker Space, configuring it, and deploying your code to it. We\u2019ll create a "),_s=o(Us,"STRONG",{});var Tr=r(_s);wa=a(Tr,"Text Generation"),Tr.forEach(t),ja=a(Us," Space with Docker that\u2019ll be used to demo the "),ge=o(Us,"A",{href:!0,rel:!0});var Jr=r(ge);ga=a(Jr,"google/flan-t5-small"),Jr.forEach(t),Ta=a(Us," model, which can generate text given some input text, using FastAPI as the server."),Us.forEach(t),Qt=u(e),H=o(e,"P",{});var Ll=r(H);Ja=a(Ll,"You can find a completed version of this hosted "),Te=o(Ll,"A",{href:!0,rel:!0});var Ur=r(Te);Ua=a(Ur,"here"),Ur.forEach(t),va=a(Ll,"."),Ll.forEach(t),Ft=u(e),V=o(e,"H2",{class:!0});var Hl=r(V);P=o(Hl,"A",{id:!0,class:!0,href:!0});var vr=r(P);Ss=o(vr,"SPAN",{});var Er=r(Ss);d(Je.$$.fragment,Er),Er.forEach(t),vr.forEach(t),Ea=u(Hl),Rs=o(Hl,"SPAN",{});var kr=r(Rs);ka=a(kr,"Create a new Docker Space"),kr.forEach(t),Hl.forEach(t),xt=u(e),A=o(e,"P",{});var vs=r(A);ba=a(vs,"We\u2019ll start by "),Ue=o(vs,"A",{href:!0,rel:!0});var br=r(Ue);Ia=a(br,"creating a brand new Space"),br.forEach(t),_a=a(vs," and choosing "),As=o(vs,"STRONG",{});var Ir=r(As);Sa=a(Ir,"Docker"),Ir.forEach(t),Ra=a(vs," as our SDK."),vs.forEach(t),Xt=u(e),ve=o(e,"DIV",{class:!0});var _r=r(ve);$s=o(_r,"IMG",{src:!0}),_r.forEach(t),qt=u(e),z=o(e,"P",{});var Pl=r(z);Aa=a(Pl,"Hugging Face Spaces are Git repositories, meaning that you can work on your Space incrementally (and collaboratively) by pushing commits. Take a look at the "),ms=o(Pl,"A",{href:!0});var Sr=r(ms);$a=a(Sr,"Getting Started with Repositories"),Sr.forEach(t),Ca=a(Pl," guide to learn about how you can create and edit files before continuing. If you prefer to work with a UI, you can also do the work directly in the browser."),Pl.forEach(t),Yt=u(e),j=o(e,"P",{});var _=r(j);Ba=a(_,"Selecting "),Cs=o(_,"STRONG",{});var Rr=r(Cs);Ga=a(Rr,"Docker"),Rr.forEach(t),Za=a(_," as the SDK when "),Ee=o(_,"A",{href:!0,rel:!0});var Ar=r(Ee);Va=a(Ar,"creating a new Space"),Ar.forEach(t),Na=a(_," will initialize your Docker Space by setting the "),Bs=o(_,"CODE",{});var $r=r(Bs);Da=a($r,"sdk"),$r.forEach(t),Wa=a(_," property to "),Gs=o(_,"CODE",{});var Cr=r(Gs);Qa=a(Cr,"docker"),Cr.forEach(t),Fa=a(_," in your "),Zs=o(_,"CODE",{});var Br=r(Zs);xa=a(Br,"README.md"),Br.forEach(t),Xa=a(_," file\u2019s YAML block."),_.forEach(t),Lt=u(e),d(ke.$$.fragment,e),Ht=u(e),U=o(e,"P",{});var fe=r(U);qa=a(fe,"You have the option to change the default application port of your Space by setting the "),Vs=o(fe,"CODE",{});var Gr=r(Vs);Ya=a(Gr,"app_port"),Gr.forEach(t),La=a(fe," property in your "),Ns=o(fe,"CODE",{});var Zr=r(Ns);Ha=a(Zr,"README.md"),Zr.forEach(t),Pa=a(fe," file\u2019s YAML block. The default port is "),Ds=o(fe,"CODE",{});var Vr=r(Ds);za=a(Vr,"7860"),Vr.forEach(t),Oa=a(fe,"."),fe.forEach(t),Pt=u(e),d(be.$$.fragment,e),zt=u(e),N=o(e,"H2",{class:!0});var zl=r(N);O=o(zl,"A",{id:!0,class:!0,href:!0});var Nr=r(O);Ws=o(Nr,"SPAN",{});var Dr=r(Ws);d(Ie.$$.fragment,Dr),Dr.forEach(t),Nr.forEach(t),Ka=u(zl),Qs=o(zl,"SPAN",{});var Wr=r(Qs);en=a(Wr,"Add the dependencies"),Wr.forEach(t),zl.forEach(t),Ot=u(e),v=o(e,"P",{});var de=r(v);sn=a(de,"For the "),Fs=o(de,"STRONG",{});var Qr=r(Fs);tn=a(Qr,"Text Generation"),Qr.forEach(t),ln=a(de," Space, we\u2019ll be building a FastAPI app that showcases a text generation model called Flan T5. For the model inference, we\u2019ll be using a "),_e=o(de,"A",{href:!0,rel:!0});var Fr=r(_e);an=a(Fr,"\u{1F917} Transformers pipeline"),Fr.forEach(t),nn=a(de," to use the model. We need to start by installing a few dependencies. This can be done by creating a "),xs=o(de,"STRONG",{});var xr=r(xs);on=a(xr,"requirements.txt"),xr.forEach(t),rn=a(de," file in our repository, and adding the following dependencies to it:"),de.forEach(t),Kt=u(e),d(Se.$$.fragment,e),el=u(e),ys=o(e,"P",{});var Xr=r(ys);pn=a(Xr,"These dependencies will be installed in the Dockerfile we\u2019ll create later."),Xr.forEach(t),sl=u(e),D=o(e,"H2",{class:!0});var Ol=r(D);K=o(Ol,"A",{id:!0,class:!0,href:!0});var qr=r(K);Xs=o(qr,"SPAN",{});var Yr=r(Xs);d(Re.$$.fragment,Yr),Yr.forEach(t),qr.forEach(t),cn=u(Ol),qs=o(Ol,"SPAN",{});var Lr=r(qs);hn=a(Lr,"Create the app"),Lr.forEach(t),Ol.forEach(t),tl=u(e),ee=o(e,"P",{});var Kl=r(ee);un=a(Kl,"Let\u2019s kick off the process with a dummy FastAPI app to see that we can get an endpoint working. The first step is to create an app file, in this case, we\u2019ll call it "),Ys=o(Kl,"CODE",{});var Hr=r(Ys);fn=a(Hr,"main.py"),Hr.forEach(t),dn=a(Kl,"."),Kl.forEach(t),ll=u(e),d(Ae.$$.fragment,e),al=u(e),W=o(e,"H2",{class:!0});var ea=r(W);se=o(ea,"A",{id:!0,class:!0,href:!0});var Pr=r(se);Ls=o(Pr,"SPAN",{});var zr=r(Ls);d($e.$$.fragment,zr),zr.forEach(t),Pr.forEach(t),mn=u(ea),Hs=o(ea,"SPAN",{});var Or=r(Hs);yn=a(Or,"Create the Dockerfile"),Or.forEach(t),ea.forEach(t),nl=u(e),te=o(e,"P",{});var sa=r(te);Mn=a(sa,"The main step for a Docker Space is creating a Dockerfile. You can read more about Dockerfiles "),Ce=o(sa,"A",{href:!0,rel:!0});var Kr=r(Ce);wn=a(Kr,"here"),Kr.forEach(t),jn=a(sa,". Although we\u2019re using FastAPI in this tutorial, Dockerfiles give great flexibility to users allowing you to build a new generation of ML demos. Let\u2019s write the Dockerfile for our application"),sa.forEach(t),ol=u(e),d(Be.$$.fragment,e),rl=u(e),le=o(e,"P",{});var ta=r(le);gn=a(ta,"When the changes are saved, the Space will rebuild and your demo should be up after a couple of seconds! "),Ge=o(ta,"A",{href:!0,rel:!0});var ep=r(Ge);Tn=a(ep,"Here"),ep.forEach(t),Jn=a(ta," is an example result at this point."),ta.forEach(t),pl=u(e),Ze=o(e,"DIV",{class:!0});var sp=r(Ze);Ps=o(sp,"IMG",{src:!0}),sp.forEach(t),il=u(e),Q=o(e,"H3",{class:!0});var la=r(Q);ae=o(la,"A",{id:!0,class:!0,href:!0});var tp=r(ae);zs=o(tp,"SPAN",{});var lp=r(zs);d(Ve.$$.fragment,lp),lp.forEach(t),tp.forEach(t),Un=u(la),Os=o(la,"SPAN",{});var ap=r(Os);vn=a(ap,"Testing locally"),ap.forEach(t),la.forEach(t),cl=u(e),S=o(e,"P",{});var ds=r(S);Ks=o(ds,"STRONG",{});var np=r(Ks);En=a(np,"Tip for power users (you can skip):"),np.forEach(t),kn=a(ds," If you\u2019re developing locally, this is a good moment in which you can do "),et=o(ds,"CODE",{});var op=r(et);bn=a(op,"docker build"),op.forEach(t),In=a(ds," and "),st=o(ds,"CODE",{});var rp=r(st);_n=a(rp,"docker run"),rp.forEach(t),Sn=a(ds," to debug locally, but it\u2019s even easier to push the changes to the Hub and see how it looks like!"),ds.forEach(t),hl=u(e),d(Ne.$$.fragment,e),ul=u(e),$=o(e,"P",{});var Es=r($);Rn=a(Es,"If you have "),Ms=o(Es,"A",{href:!0});var pp=r(Ms);An=a(pp,"Secrets"),pp.forEach(t),$n=a(Es," you can use "),tt=o(Es,"CODE",{});var ip=r(tt);Cn=a(ip,"docker buildx"),ip.forEach(t),Bn=a(Es," and pass the secrets as build arguments"),Es.forEach(t),fl=u(e),d(De.$$.fragment,e),dl=u(e),ne=o(e,"P",{});var aa=r(ne);Gn=a(aa,"and run with "),lt=o(aa,"CODE",{});var cp=r(lt);Zn=a(cp,"docker run"),cp.forEach(t),Vn=a(aa," passing the secrets as environment variables"),aa.forEach(t),ml=u(e),d(We.$$.fragment,e),yl=u(e),F=o(e,"H2",{class:!0});var na=r(F);oe=o(na,"A",{id:!0,class:!0,href:!0});var hp=r(oe);at=o(hp,"SPAN",{});var up=r(at);d(Qe.$$.fragment,up),up.forEach(t),hp.forEach(t),Nn=u(na),nt=o(na,"SPAN",{});var fp=r(nt);Dn=a(fp,"Adding some ML to our app"),fp.forEach(t),na.forEach(t),Ml=u(e),E=o(e,"P",{});var me=r(E);Wn=a(me,"As mentioned before, the idea is to use a Flan T5 model for text generation. We\u2019ll want to add some HTML and CSS for an input field, so let\u2019s create a directory called static with "),ot=o(me,"CODE",{});var dp=r(ot);Qn=a(dp,"index.html"),dp.forEach(t),Fn=a(me,", "),rt=o(me,"CODE",{});var mp=r(rt);xn=a(mp,"style.css"),mp.forEach(t),Xn=a(me,", and "),pt=o(me,"CODE",{});var yp=r(pt);qn=a(yp,"script.js"),yp.forEach(t),Yn=a(me," files. At this moment, your file structure should look like this:"),me.forEach(t),wl=u(e),d(Fe.$$.fragment,e),jl=u(e),re=o(e,"P",{});var oa=r(re);Ln=a(oa,"Let\u2019s go through all the steps to make this working. We\u2019ll skip some of the details of the CSS and HTML. You can find the whole code in the Files and versions tab of the "),xe=o(oa,"A",{href:!0,rel:!0});var Mp=r(xe);Hn=a(Mp,"DockerTemplates/fastapi_t5"),Mp.forEach(t),Pn=a(oa," Space."),oa.forEach(t),gl=u(e),ws=o(e,"OL",{});var wp=r(ws);it=o(wp,"LI",{});var jp=r(it);zn=a(jp,"Write the FastAPI endpoint to do inference"),jp.forEach(t),wp.forEach(t),Tl=u(e),T=o(e,"P",{});var C=r(T);On=a(C,"We\u2019ll use the "),ct=o(C,"CODE",{});var gp=r(ct);Kn=a(gp,"pipeline"),gp.forEach(t),eo=a(C," from "),ht=o(C,"CODE",{});var Tp=r(ht);so=a(Tp,"transformers"),Tp.forEach(t),to=a(C," to load the "),Xe=o(C,"A",{href:!0,rel:!0});var Jp=r(Xe);lo=a(Jp,"google/flan-t5-small"),Jp.forEach(t),ao=a(C," model. We\u2019ll set an endpoint called "),ut=o(C,"CODE",{});var Up=r(ut);no=a(Up,"infer_t5"),Up.forEach(t),oo=a(C," that receives and input and outputs the result of the inference call"),C.forEach(t),Jl=u(e),d(qe.$$.fragment,e),Ul=u(e),Ye=o(e,"OL",{start:!0});var vp=r(Ye);Le=o(vp,"LI",{});var ra=r(Le);ro=a(ra,"Write the "),ft=o(ra,"CODE",{});var Ep=r(ft);po=a(Ep,"index.html"),Ep.forEach(t),io=a(ra," to have a simple form containing the code of the page."),ra.forEach(t),vp.forEach(t),vl=u(e),d(He.$$.fragment,e),El=u(e),Pe=o(e,"OL",{start:!0});var kp=r(Pe);ze=o(kp,"LI",{});var pa=r(ze);co=a(pa,"In the "),dt=o(pa,"CODE",{});var bp=r(dt);ho=a(bp,"app.py"),bp.forEach(t),uo=a(pa," file, mount the static files and show the html file in the root route"),pa.forEach(t),kp.forEach(t),kl=u(e),d(Oe.$$.fragment,e),bl=u(e),Ke=o(e,"OL",{start:!0});var Ip=r(Ke);es=o(Ip,"LI",{});var ia=r(es);fo=a(ia,"In the "),mt=o(ia,"CODE",{});var _p=r(mt);mo=a(_p,"script.js"),_p.forEach(t),yo=a(ia," file, make it handle the request"),ia.forEach(t),Ip.forEach(t),Il=u(e),d(ss.$$.fragment,e),_l=u(e),ts=o(e,"OL",{start:!0});var Sp=r(ts);yt=o(Sp,"LI",{});var Rp=r(yt);Mo=a(Rp,"Grant permissions to the right directories"),Rp.forEach(t),Sp.forEach(t),Sl=u(e),J=o(e,"P",{});var B=r(J);wo=a(B,"As discussed in the "),js=o(B,"A",{href:!0});var Ap=r(js);jo=a(Ap,"Permissions Section"),Ap.forEach(t),go=a(B,", the container runs with user ID 1000. That means that the Space might face permission issues. For example, "),Mt=o(B,"CODE",{});var $p=r(Mt);To=a($p,"transformers"),$p.forEach(t),Jo=a(B," downloads and caches the models in the path under the "),wt=o(B,"CODE",{});var Cp=r(wt);Uo=a(Cp,"HUGGINGFACE_HUB_CACHE"),Cp.forEach(t),vo=a(B," path. The easiest way to solve this is to create a user with righ permissions and use it to run the container application. We can do this by adding the following lines to the "),jt=o(B,"CODE",{});var Bp=r(jt);Eo=a(Bp,"Dockerfile"),Bp.forEach(t),ko=a(B,"."),B.forEach(t),Rl=u(e),d(ls.$$.fragment,e),Al=u(e),pe=o(e,"P",{});var ca=r(pe);bo=a(ca,"The final "),gt=o(ca,"CODE",{});var Gp=r(gt);Io=a(Gp,"Dockerfile"),Gp.forEach(t),_o=a(ca," should look like this:"),ca.forEach(t),$l=u(e),d(as.$$.fragment,e),Cl=u(e),ie=o(e,"P",{});var ha=r(ie);So=a(ha,"Success! Your app should be working now! Check out "),ns=o(ha,"A",{href:!0,rel:!0});var Zp=r(ns);Ro=a(Zp,"DockerTemplates/fastapi_t5"),Zp.forEach(t),Ao=a(ha," to see the final result."),ha.forEach(t),Bl=u(e),os=o(e,"DIV",{class:!0});var Vp=r(os);Tt=o(Vp,"IMG",{src:!0}),Vp.forEach(t),Gl=u(e),k=o(e,"P",{});var ye=r(k);$o=a(ye,"What a journey! Please remember that Docker Spaces give you lots of freedom, so you\u2019re not limited to use FastAPI. From a "),rs=o(ye,"A",{href:!0,rel:!0});var Np=r(rs);Co=a(Np,"Go Endpoint"),Np.forEach(t),Bo=a(ye," to a "),ps=o(ye,"A",{href:!0,rel:!0});var Dp=r(ps);Go=a(Dp,"Shiny App"),Dp.forEach(t),Zo=a(ye,", the limit is the moon! Check out "),gs=o(ye,"A",{href:!0});var Wp=r(gs);Vo=a(Wp,"some official examples"),Wp.forEach(t),No=a(ye,". You can also upgrade your Space to a GPU if needed \u{1F603}"),ye.forEach(t),Zl=u(e),x=o(e,"H2",{class:!0});var ua=r(x);ce=o(ua,"A",{id:!0,class:!0,href:!0});var Qp=r(ce);Jt=o(Qp,"SPAN",{});var Fp=r(Jt);d(is.$$.fragment,Fp),Fp.forEach(t),Qp.forEach(t),Do=u(ua),Ut=o(ua,"SPAN",{});var xp=r(Ut);Wo=a(xp,"Debugging"),xp.forEach(t),ua.forEach(t),Vl=u(e),b=o(e,"P",{});var Me=r(b);Qo=a(Me,"You can debug your Space by checking the "),vt=o(Me,"STRONG",{});var Xp=r(vt);Fo=a(Xp,"Build"),Xp.forEach(t),xo=a(Me," and "),Et=o(Me,"STRONG",{});var qp=r(Et);Xo=a(qp,"Container"),qp.forEach(t),qo=a(Me," logs. Click on the "),kt=o(Me,"STRONG",{});var Yp=r(kt);Yo=a(Yp,"Open Logs"),Yp.forEach(t),Lo=a(Me," button to open the modal."),Me.forEach(t),Nl=u(e),cs=o(e,"DIV",{class:!0});var Lp=r(cs);bt=o(Lp,"IMG",{src:!0}),Lp.forEach(t),Dl=u(e),I=o(e,"P",{});var we=r(I);Ho=a(we,"If everything went well, you will see "),It=o(we,"CODE",{});var Hp=r(It);Po=a(Hp,"Pushing Image"),Hp.forEach(t),zo=a(we," and "),_t=o(we,"CODE",{});var Pp=r(_t);Oo=a(Pp,"Scheduling Space"),Pp.forEach(t),Ko=a(we," on the "),St=o(we,"STRONG",{});var zp=r(St);er=a(zp,"Build"),zp.forEach(t),sr=a(we," tab"),we.forEach(t),Wl=u(e),hs=o(e,"DIV",{class:!0});var Op=r(hs);Rt=o(Op,"IMG",{src:!0}),Op.forEach(t),Ql=u(e),X=o(e,"P",{});var Nt=r(X);tr=a(Nt,"On the "),At=o(Nt,"STRONG",{});var Kp=r(At);lr=a(Kp,"Container"),Kp.forEach(t),ar=a(Nt," tab, you will see the application status, in this case, "),$t=o(Nt,"CODE",{});var ei=r($t);nr=a(ei,"Uvicorn running on http://0.0.0.0:7860"),ei.forEach(t),Nt.forEach(t),Fl=u(e),us=o(e,"DIV",{class:!0});var si=r(us);Ct=o(si,"IMG",{src:!0}),si.forEach(t),xl=u(e),q=o(e,"H2",{class:!0});var fa=r(q);he=o(fa,"A",{id:!0,class:!0,href:!0});var ti=r(he);Bt=o(ti,"SPAN",{});var li=r(Bt);d(fs.$$.fragment,li),li.forEach(t),ti.forEach(t),or=u(fa),Gt=o(fa,"SPAN",{});var ai=r(Gt);rr=a(ai,"Read More"),ai.forEach(t),fa.forEach(t),Xl=u(e),ue=o(e,"UL",{});var da=r(ue);Zt=o(da,"LI",{});var ni=r(Zt);Ts=o(ni,"A",{href:!0});var oi=r(Ts);pr=a(oi,"Docker Spaces"),oi.forEach(t),ni.forEach(t),ir=u(da),Vt=o(da,"LI",{});var ri=r(Vt);Js=o(ri,"A",{href:!0});var pi=r(Js);cr=a(pi,"List of Docker Spaces examples"),pi.forEach(t),ri.forEach(t),da.forEach(t),this.h()},h(){c(G,"name","hf:doc:metadata"),c(G,"content",JSON.stringify(yi)),c(L,"id","your-first-docker-space-text-generation-with-t5"),c(L,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(L,"href","#your-first-docker-space-text-generation-with-t5"),c(Z,"class","relative group"),c(ge,"href","https://huggingface.co/google/flan-t5-small"),c(ge,"rel","nofollow"),c(Te,"href","https://huggingface.co/spaces/DockerTemplates/fastapi_t5"),c(Te,"rel","nofollow"),c(P,"id","create-a-new-docker-space"),c(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(P,"href","#create-a-new-docker-space"),c(V,"class","relative group"),c(Ue,"href","https://huggingface.co/new-space"),c(Ue,"rel","nofollow"),ks($s.src,ur="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/huggingface.co_new-space_docker.jpg")||c($s,"src",ur),c(ve,"class","flex justify-center"),c(ms,"href","./repositories-getting-started"),c(Ee,"href","https://huggingface.co/new-space"),c(Ee,"rel","nofollow"),c(O,"id","add-the-dependencies"),c(O,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(O,"href","#add-the-dependencies"),c(N,"class","relative group"),c(_e,"href","https://huggingface.co/docs/transformers/pipeline_tutorial"),c(_e,"rel","nofollow"),c(K,"id","create-the-app"),c(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(K,"href","#create-the-app"),c(D,"class","relative group"),c(se,"id","create-the-dockerfile"),c(se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(se,"href","#create-the-dockerfile"),c(W,"class","relative group"),c(Ce,"href","https://docs.docker.com/get-started/"),c(Ce,"rel","nofollow"),c(Ge,"href","https://huggingface.co/spaces/DockerTemplates/fastapi_dummy"),c(Ge,"rel","nofollow"),ks(Ps.src,fr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/huggingface.co_spaces_docker_dummy.jpg")||c(Ps,"src",fr),c(Ze,"class","flex justify-center"),c(ae,"id","testing-locally"),c(ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ae,"href","#testing-locally"),c(Q,"class","relative group"),c(Ms,"href","spaces-sdks-docker#secret-management"),c(oe,"id","adding-some-ml-to-our-app"),c(oe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(oe,"href","#adding-some-ml-to-our-app"),c(F,"class","relative group"),c(xe,"href","https://huggingface.co/spaces/DockerTemplates/fastapi_t5"),c(xe,"rel","nofollow"),c(Xe,"href","https://huggingface.co/google/flan-t5-small"),c(Xe,"rel","nofollow"),c(Ye,"start","2"),c(Pe,"start","3"),c(Ke,"start","4"),c(ts,"start","5"),c(js,"href","./spaces-sdks-docker#permissions"),c(ns,"href","https://huggingface.co/spaces/DockerTemplates/fastapi_t5"),c(ns,"rel","nofollow"),ks(Tt.src,dr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/huggingface.co_spaces_docker_fastapi_t5.jpg")||c(Tt,"src",dr),c(os,"class","flex justify-center"),c(rs,"href","https://huggingface.co/spaces/DockerTemplates/test-docker-go"),c(rs,"rel","nofollow"),c(ps,"href","https://huggingface.co/spaces/DockerTemplates/shiny-with-python"),c(ps,"rel","nofollow"),c(gs,"href","./spaces-sdks-docker-examples"),c(ce,"id","debugging"),c(ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ce,"href","#debugging"),c(x,"class","relative group"),ks(bt.src,mr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/huggingface.co_spaces_docker_fastapi_t5_3.jpg")||c(bt,"src",mr),c(cs,"class","flex justify-center"),ks(Rt.src,yr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/huggingface.co_spaces_docker_fastapi_t5_1.jpg")||c(Rt,"src",yr),c(hs,"class","flex justify-center"),ks(Ct.src,Mr="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/huggingface.co_spaces_docker_fastapi_t5_2.jpg")||c(Ct,"src",Mr),c(us,"class","flex justify-center"),c(he,"id","read-more"),c(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(he,"href","#read-more"),c(q,"class","relative group"),c(Ts,"href","spaces-sdks-docker"),c(Js,"href","spaces-sdks-docker-examples")},m(e,p){s(document.head,G),i(e,Dt,p),i(e,Z,p),s(Z,L),s(L,bs),m(je,bs,null),s(Z,ma),s(Z,Is),s(Is,ya),i(e,Wt,p),i(e,R,p),s(R,Ma),s(R,_s),s(_s,wa),s(R,ja),s(R,ge),s(ge,ga),s(R,Ta),i(e,Qt,p),i(e,H,p),s(H,Ja),s(H,Te),s(Te,Ua),s(H,va),i(e,Ft,p),i(e,V,p),s(V,P),s(P,Ss),m(Je,Ss,null),s(V,Ea),s(V,Rs),s(Rs,ka),i(e,xt,p),i(e,A,p),s(A,ba),s(A,Ue),s(Ue,Ia),s(A,_a),s(A,As),s(As,Sa),s(A,Ra),i(e,Xt,p),i(e,ve,p),s(ve,$s),i(e,qt,p),i(e,z,p),s(z,Aa),s(z,ms),s(ms,$a),s(z,Ca),i(e,Yt,p),i(e,j,p),s(j,Ba),s(j,Cs),s(Cs,Ga),s(j,Za),s(j,Ee),s(Ee,Va),s(j,Na),s(j,Bs),s(Bs,Da),s(j,Wa),s(j,Gs),s(Gs,Qa),s(j,Fa),s(j,Zs),s(Zs,xa),s(j,Xa),i(e,Lt,p),m(ke,e,p),i(e,Ht,p),i(e,U,p),s(U,qa),s(U,Vs),s(Vs,Ya),s(U,La),s(U,Ns),s(Ns,Ha),s(U,Pa),s(U,Ds),s(Ds,za),s(U,Oa),i(e,Pt,p),m(be,e,p),i(e,zt,p),i(e,N,p),s(N,O),s(O,Ws),m(Ie,Ws,null),s(N,Ka),s(N,Qs),s(Qs,en),i(e,Ot,p),i(e,v,p),s(v,sn),s(v,Fs),s(Fs,tn),s(v,ln),s(v,_e),s(_e,an),s(v,nn),s(v,xs),s(xs,on),s(v,rn),i(e,Kt,p),m(Se,e,p),i(e,el,p),i(e,ys,p),s(ys,pn),i(e,sl,p),i(e,D,p),s(D,K),s(K,Xs),m(Re,Xs,null),s(D,cn),s(D,qs),s(qs,hn),i(e,tl,p),i(e,ee,p),s(ee,un),s(ee,Ys),s(Ys,fn),s(ee,dn),i(e,ll,p),m(Ae,e,p),i(e,al,p),i(e,W,p),s(W,se),s(se,Ls),m($e,Ls,null),s(W,mn),s(W,Hs),s(Hs,yn),i(e,nl,p),i(e,te,p),s(te,Mn),s(te,Ce),s(Ce,wn),s(te,jn),i(e,ol,p),m(Be,e,p),i(e,rl,p),i(e,le,p),s(le,gn),s(le,Ge),s(Ge,Tn),s(le,Jn),i(e,pl,p),i(e,Ze,p),s(Ze,Ps),i(e,il,p),i(e,Q,p),s(Q,ae),s(ae,zs),m(Ve,zs,null),s(Q,Un),s(Q,Os),s(Os,vn),i(e,cl,p),i(e,S,p),s(S,Ks),s(Ks,En),s(S,kn),s(S,et),s(et,bn),s(S,In),s(S,st),s(st,_n),s(S,Sn),i(e,hl,p),m(Ne,e,p),i(e,ul,p),i(e,$,p),s($,Rn),s($,Ms),s(Ms,An),s($,$n),s($,tt),s(tt,Cn),s($,Bn),i(e,fl,p),m(De,e,p),i(e,dl,p),i(e,ne,p),s(ne,Gn),s(ne,lt),s(lt,Zn),s(ne,Vn),i(e,ml,p),m(We,e,p),i(e,yl,p),i(e,F,p),s(F,oe),s(oe,at),m(Qe,at,null),s(F,Nn),s(F,nt),s(nt,Dn),i(e,Ml,p),i(e,E,p),s(E,Wn),s(E,ot),s(ot,Qn),s(E,Fn),s(E,rt),s(rt,xn),s(E,Xn),s(E,pt),s(pt,qn),s(E,Yn),i(e,wl,p),m(Fe,e,p),i(e,jl,p),i(e,re,p),s(re,Ln),s(re,xe),s(xe,Hn),s(re,Pn),i(e,gl,p),i(e,ws,p),s(ws,it),s(it,zn),i(e,Tl,p),i(e,T,p),s(T,On),s(T,ct),s(ct,Kn),s(T,eo),s(T,ht),s(ht,so),s(T,to),s(T,Xe),s(Xe,lo),s(T,ao),s(T,ut),s(ut,no),s(T,oo),i(e,Jl,p),m(qe,e,p),i(e,Ul,p),i(e,Ye,p),s(Ye,Le),s(Le,ro),s(Le,ft),s(ft,po),s(Le,io),i(e,vl,p),m(He,e,p),i(e,El,p),i(e,Pe,p),s(Pe,ze),s(ze,co),s(ze,dt),s(dt,ho),s(ze,uo),i(e,kl,p),m(Oe,e,p),i(e,bl,p),i(e,Ke,p),s(Ke,es),s(es,fo),s(es,mt),s(mt,mo),s(es,yo),i(e,Il,p),m(ss,e,p),i(e,_l,p),i(e,ts,p),s(ts,yt),s(yt,Mo),i(e,Sl,p),i(e,J,p),s(J,wo),s(J,js),s(js,jo),s(J,go),s(J,Mt),s(Mt,To),s(J,Jo),s(J,wt),s(wt,Uo),s(J,vo),s(J,jt),s(jt,Eo),s(J,ko),i(e,Rl,p),m(ls,e,p),i(e,Al,p),i(e,pe,p),s(pe,bo),s(pe,gt),s(gt,Io),s(pe,_o),i(e,$l,p),m(as,e,p),i(e,Cl,p),i(e,ie,p),s(ie,So),s(ie,ns),s(ns,Ro),s(ie,Ao),i(e,Bl,p),i(e,os,p),s(os,Tt),i(e,Gl,p),i(e,k,p),s(k,$o),s(k,rs),s(rs,Co),s(k,Bo),s(k,ps),s(ps,Go),s(k,Zo),s(k,gs),s(gs,Vo),s(k,No),i(e,Zl,p),i(e,x,p),s(x,ce),s(ce,Jt),m(is,Jt,null),s(x,Do),s(x,Ut),s(Ut,Wo),i(e,Vl,p),i(e,b,p),s(b,Qo),s(b,vt),s(vt,Fo),s(b,xo),s(b,Et),s(Et,Xo),s(b,qo),s(b,kt),s(kt,Yo),s(b,Lo),i(e,Nl,p),i(e,cs,p),s(cs,bt),i(e,Dl,p),i(e,I,p),s(I,Ho),s(I,It),s(It,Po),s(I,zo),s(I,_t),s(_t,Oo),s(I,Ko),s(I,St),s(St,er),s(I,sr),i(e,Wl,p),i(e,hs,p),s(hs,Rt),i(e,Ql,p),i(e,X,p),s(X,tr),s(X,At),s(At,lr),s(X,ar),s(X,$t),s($t,nr),i(e,Fl,p),i(e,us,p),s(us,Ct),i(e,xl,p),i(e,q,p),s(q,he),s(he,Bt),m(fs,Bt,null),s(q,or),s(q,Gt),s(Gt,rr),i(e,Xl,p),i(e,ue,p),s(ue,Zt),s(Zt,Ts),s(Ts,pr),s(ue,ir),s(ue,Vt),s(Vt,Js),s(Js,cr),ql=!0},p:fi,i(e){ql||(y(je.$$.fragment,e),y(Je.$$.fragment,e),y(ke.$$.fragment,e),y(be.$$.fragment,e),y(Ie.$$.fragment,e),y(Se.$$.fragment,e),y(Re.$$.fragment,e),y(Ae.$$.fragment,e),y($e.$$.fragment,e),y(Be.$$.fragment,e),y(Ve.$$.fragment,e),y(Ne.$$.fragment,e),y(De.$$.fragment,e),y(We.$$.fragment,e),y(Qe.$$.fragment,e),y(Fe.$$.fragment,e),y(qe.$$.fragment,e),y(He.$$.fragment,e),y(Oe.$$.fragment,e),y(ss.$$.fragment,e),y(ls.$$.fragment,e),y(as.$$.fragment,e),y(is.$$.fragment,e),y(fs.$$.fragment,e),ql=!0)},o(e){M(je.$$.fragment,e),M(Je.$$.fragment,e),M(ke.$$.fragment,e),M(be.$$.fragment,e),M(Ie.$$.fragment,e),M(Se.$$.fragment,e),M(Re.$$.fragment,e),M(Ae.$$.fragment,e),M($e.$$.fragment,e),M(Be.$$.fragment,e),M(Ve.$$.fragment,e),M(Ne.$$.fragment,e),M(De.$$.fragment,e),M(We.$$.fragment,e),M(Qe.$$.fragment,e),M(Fe.$$.fragment,e),M(qe.$$.fragment,e),M(He.$$.fragment,e),M(Oe.$$.fragment,e),M(ss.$$.fragment,e),M(ls.$$.fragment,e),M(as.$$.fragment,e),M(is.$$.fragment,e),M(fs.$$.fragment,e),ql=!1},d(e){t(G),e&&t(Dt),e&&t(Z),w(je),e&&t(Wt),e&&t(R),e&&t(Qt),e&&t(H),e&&t(Ft),e&&t(V),w(Je),e&&t(xt),e&&t(A),e&&t(Xt),e&&t(ve),e&&t(qt),e&&t(z),e&&t(Yt),e&&t(j),e&&t(Lt),w(ke,e),e&&t(Ht),e&&t(U),e&&t(Pt),w(be,e),e&&t(zt),e&&t(N),w(Ie),e&&t(Ot),e&&t(v),e&&t(Kt),w(Se,e),e&&t(el),e&&t(ys),e&&t(sl),e&&t(D),w(Re),e&&t(tl),e&&t(ee),e&&t(ll),w(Ae,e),e&&t(al),e&&t(W),w($e),e&&t(nl),e&&t(te),e&&t(ol),w(Be,e),e&&t(rl),e&&t(le),e&&t(pl),e&&t(Ze),e&&t(il),e&&t(Q),w(Ve),e&&t(cl),e&&t(S),e&&t(hl),w(Ne,e),e&&t(ul),e&&t($),e&&t(fl),w(De,e),e&&t(dl),e&&t(ne),e&&t(ml),w(We,e),e&&t(yl),e&&t(F),w(Qe),e&&t(Ml),e&&t(E),e&&t(wl),w(Fe,e),e&&t(jl),e&&t(re),e&&t(gl),e&&t(ws),e&&t(Tl),e&&t(T),e&&t(Jl),w(qe,e),e&&t(Ul),e&&t(Ye),e&&t(vl),w(He,e),e&&t(El),e&&t(Pe),e&&t(kl),w(Oe,e),e&&t(bl),e&&t(Ke),e&&t(Il),w(ss,e),e&&t(_l),e&&t(ts),e&&t(Sl),e&&t(J),e&&t(Rl),w(ls,e),e&&t(Al),e&&t(pe),e&&t($l),w(as,e),e&&t(Cl),e&&t(ie),e&&t(Bl),e&&t(os),e&&t(Gl),e&&t(k),e&&t(Zl),e&&t(x),w(is),e&&t(Vl),e&&t(b),e&&t(Nl),e&&t(cs),e&&t(Dl),e&&t(I),e&&t(Wl),e&&t(hs),e&&t(Ql),e&&t(X),e&&t(Fl),e&&t(us),e&&t(xl),e&&t(q),w(fs),e&&t(Xl),e&&t(ue)}}}const yi={local:"your-first-docker-space-text-generation-with-t5",sections:[{local:"create-a-new-docker-space",title:"Create a new Docker Space"},{local:"add-the-dependencies",title:"Add the dependencies"},{local:"create-the-app",title:"Create the app"},{local:"create-the-dockerfile",sections:[{local:"testing-locally",title:"Testing locally"}],title:"Create the Dockerfile"},{local:"adding-some-ml-to-our-app",title:"Adding some ML to our app"},{local:"debugging",title:"Debugging"},{local:"read-more",title:"Read More"}],title:"Your First Docker Space: Text Generation with T5"};function Mi(hr){return di(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ti extends ii{constructor(G){super();ci(this,G,Mi,mi,hi,{})}}export{Ti as default,yi as metadata};
