import{s as De,n as Ee,o as Fe}from"../chunks/scheduler.d6170356.js";import{S as qe,i as ze,g as a,s as l,r as ae,A as Ue,h as s,f as i,c as o,j as Ae,u as se,x as r,k as oe,y as je,a as n,v as re,d as pe,t as he,w as ue}from"../chunks/index.fcd4cc08.js";import{H as fe}from"../chunks/Heading.8660bd0e.js";function Ie(ce){let p,D,R,E,f,F,c,me=`<a href="https://shiny.posit.co/" rel="nofollow">Shiny</a> is an open-source framework for building simple, beautiful, and performant data applications.
The goal when developing Shiny was to build something simple enough to teach someone in an afternoon but extensible enough to power large, mission-critical applications.
You can create a useful Shiny app in a few minutes, but if the scope of your project grows, you can be sure that Shiny can accommodate that application.`,q,m,ye=`The main feature that differentiates Shiny from other frameworks is its reactive execution model.
When you write a Shiny app, the framework infers the relationship between inputs, outputs, and intermediary calculations and uses those relationships to render only the things that need to change as a result of a user’s action.
The result is that users can easily develop efficient, extensible applications without explicitly caching data or writing callback functions.`,z,y,U,d,de=`<a href="https://shiny.rstudio.com/py/" rel="nofollow">Shiny for Python</a> is a pure Python implementation of Shiny.
This gives you access to all of the great features of Shiny like reactivity, complex layouts, and modules without needing to use R.
Shiny for Python is ideal for Hugging Face applications because it integrates smoothly with other Hugging Face tools.`,j,g,ge=`To get started deploying a Space, click this button to select your hardware and specify if you want a public or private Space.
The Space template will populate a few files to get your app started.`,I,h,ve='<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg"/>',N,v,we="<em>app.py</em>",Y,w,xe=`This file defines your app’s logic. To learn more about how to modify this file, see <a href="https://shiny.rstudio.com/py/docs/overview.html" rel="nofollow">the Shiny for Python documentation</a>.
As your app gets more complex, it’s a good idea to break your application logic up into <a href="https://shiny.rstudio.com/py/docs/workflow-modules.html" rel="nofollow">modules</a>.`,G,x,Te="<em>Dockerfile</em>",K,T,be=`The Dockerfile for a Shiny for Python app is very minimal because the library doesn’t have many system dependencies, but you may need to modify this file if your application has additional system dependencies.
The one essential feature of this file is that it exposes and runs the app on the port specified in the space README file (which is 7860 by default).`,W,b,He="<strong>requirements.txt</strong>",B,H,_e=`The Space will automatically install dependencies listed in the requirements.txt file.
Note that you must include shiny in this file.`,J,_,O,S,Se=`<a href="https://shiny.rstudio.com/" rel="nofollow">Shiny for R</a> is a popular and well-established application framework in the R community and is a great choice if you want to host an R app on Hugging Face infrastructure or make use of some of the great <a href="https://github.com/nanxstats/awesome-shiny-extensions" rel="nofollow">Shiny R extensions</a>.
To integrate Hugging Face tools into an R app, you can either use <a href="https://httr2.r-lib.org/" rel="nofollow">httr2</a> to call Hugging Face APIs, or <a href="https://rstudio.github.io/reticulate/" rel="nofollow">reticulate</a> to call one of the Hugging Face Python SDKs.`,Q,C,Ce=`To deploy an R Shiny Space, click this button and fill out the space metadata.
This will populate the Space with all the files you need to get started.`,V,u,ke='<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg"/>',X,k,Pe=`<em>app.R</em>
This file contains all of your application logic. If you prefer, you can break this file up into <code>ui.R</code> and <code>server.R</code>.`,Z,P,Me="<em>Dockerfile</em>",ee,M,Le=`The Dockerfile builds off of the the <a href="https://hub.docker.com/r/rocker/shiny" rel="nofollow">rocker shiny</a> image. You’ll need to modify this file to use additional packages.
If you are using a lot of tidyverse packages we recommend switching the base image to <a href="https://hub.docker.com/r/rocker/shiny-verse" rel="nofollow">rocker/shinyverse</a>.
You can install additional R packages by adding them under the <code>RUN install2.r</code> section of the dockerfile, and github packages can be installed by adding the repository under <code>RUN installGithub.r</code>.`,te,L,$e="There are two main requirements for this Dockerfile:",ie,$,Re='<li><p>First, the file must expose the port that you have listed in the README. The default is 7860 and we recommend not changing this port unless you have a reason to.</p></li> <li><p>Second, for the moment you must use the development version of <a href="https://github.com/rstudio/httpuv" rel="nofollow">httpuv</a> which resolves an issue with app timeouts on Hugging Face.</p></li>',ne,A,le;return f=new fe({props:{title:"Shiny on Spaces",local:"shiny-on-spaces",headingTag:"h1"}}),y=new fe({props:{title:"Shiny for Python",local:"shiny-for-python",headingTag:"h2"}}),_=new fe({props:{title:"Shiny for R",local:"shiny-for-r",headingTag:"h2"}}),{c(){p=a("meta"),D=l(),R=a("p"),E=l(),ae(f.$$.fragment),F=l(),c=a("p"),c.innerHTML=me,q=l(),m=a("p"),m.textContent=ye,z=l(),ae(y.$$.fragment),U=l(),d=a("p"),d.innerHTML=de,j=l(),g=a("p"),g.textContent=ge,I=l(),h=a("a"),h.innerHTML=ve,N=l(),v=a("p"),v.innerHTML=we,Y=l(),w=a("p"),w.innerHTML=xe,G=l(),x=a("p"),x.innerHTML=Te,K=l(),T=a("p"),T.textContent=be,W=l(),b=a("p"),b.innerHTML=He,B=l(),H=a("p"),H.textContent=_e,J=l(),ae(_.$$.fragment),O=l(),S=a("p"),S.innerHTML=Se,Q=l(),C=a("p"),C.textContent=Ce,V=l(),u=a("a"),u.innerHTML=ke,X=l(),k=a("p"),k.innerHTML=Pe,Z=l(),P=a("p"),P.innerHTML=Me,ee=l(),M=a("p"),M.innerHTML=Le,te=l(),L=a("p"),L.textContent=$e,ie=l(),$=a("ul"),$.innerHTML=Re,ne=l(),A=a("p"),this.h()},l(e){const t=Ue("svelte-u9bgzb",document.head);p=s(t,"META",{name:!0,content:!0}),t.forEach(i),D=o(e),R=s(e,"P",{}),Ae(R).forEach(i),E=o(e),se(f.$$.fragment,e),F=o(e),c=s(e,"P",{"data-svelte-h":!0}),r(c)!=="svelte-1fyo2a7"&&(c.innerHTML=me),q=o(e),m=s(e,"P",{"data-svelte-h":!0}),r(m)!=="svelte-kcedpx"&&(m.textContent=ye),z=o(e),se(y.$$.fragment,e),U=o(e),d=s(e,"P",{"data-svelte-h":!0}),r(d)!=="svelte-186vj0b"&&(d.innerHTML=de),j=o(e),g=s(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-8a31z"&&(g.textContent=ge),I=o(e),h=s(e,"A",{href:!0,"data-svelte-h":!0}),r(h)!=="svelte-1pnrizg"&&(h.innerHTML=ve),N=o(e),v=s(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-glwu2r"&&(v.innerHTML=we),Y=o(e),w=s(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-1rp2ucx"&&(w.innerHTML=xe),G=o(e),x=s(e,"P",{"data-svelte-h":!0}),r(x)!=="svelte-1yl4y91"&&(x.innerHTML=Te),K=o(e),T=s(e,"P",{"data-svelte-h":!0}),r(T)!=="svelte-16remnx"&&(T.textContent=be),W=o(e),b=s(e,"P",{"data-svelte-h":!0}),r(b)!=="svelte-16lysqv"&&(b.innerHTML=He),B=o(e),H=s(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-n6852g"&&(H.textContent=_e),J=o(e),se(_.$$.fragment,e),O=o(e),S=s(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-18dos5d"&&(S.innerHTML=Se),Q=o(e),C=s(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-969v99"&&(C.textContent=Ce),V=o(e),u=s(e,"A",{href:!0,"data-svelte-h":!0}),r(u)!=="svelte-3xytbo"&&(u.innerHTML=ke),X=o(e),k=s(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-1x3irtp"&&(k.innerHTML=Pe),Z=o(e),P=s(e,"P",{"data-svelte-h":!0}),r(P)!=="svelte-1yl4y91"&&(P.innerHTML=Me),ee=o(e),M=s(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-1mqp5nr"&&(M.innerHTML=Le),te=o(e),L=s(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-1szq3ka"&&(L.textContent=$e),ie=o(e),$=s(e,"UL",{"data-svelte-h":!0}),r($)!=="svelte-1ygyn9n"&&($.innerHTML=Re),ne=o(e),A=s(e,"P",{}),Ae(A).forEach(i),this.h()},h(){oe(p,"name","hf:doc:metadata"),oe(p,"content",Ne),oe(h,"href","https://huggingface.co/new-space?template=posit/shiny-for-python-template"),oe(u,"href","https://huggingface.co/new-space?template=posit/shiny-for-r-template")},m(e,t){je(document.head,p),n(e,D,t),n(e,R,t),n(e,E,t),re(f,e,t),n(e,F,t),n(e,c,t),n(e,q,t),n(e,m,t),n(e,z,t),re(y,e,t),n(e,U,t),n(e,d,t),n(e,j,t),n(e,g,t),n(e,I,t),n(e,h,t),n(e,N,t),n(e,v,t),n(e,Y,t),n(e,w,t),n(e,G,t),n(e,x,t),n(e,K,t),n(e,T,t),n(e,W,t),n(e,b,t),n(e,B,t),n(e,H,t),n(e,J,t),re(_,e,t),n(e,O,t),n(e,S,t),n(e,Q,t),n(e,C,t),n(e,V,t),n(e,u,t),n(e,X,t),n(e,k,t),n(e,Z,t),n(e,P,t),n(e,ee,t),n(e,M,t),n(e,te,t),n(e,L,t),n(e,ie,t),n(e,$,t),n(e,ne,t),n(e,A,t),le=!0},p:Ee,i(e){le||(pe(f.$$.fragment,e),pe(y.$$.fragment,e),pe(_.$$.fragment,e),le=!0)},o(e){he(f.$$.fragment,e),he(y.$$.fragment,e),he(_.$$.fragment,e),le=!1},d(e){e&&(i(D),i(R),i(E),i(F),i(c),i(q),i(m),i(z),i(U),i(d),i(j),i(g),i(I),i(h),i(N),i(v),i(Y),i(w),i(G),i(x),i(K),i(T),i(W),i(b),i(B),i(H),i(J),i(O),i(S),i(Q),i(C),i(V),i(u),i(X),i(k),i(Z),i(P),i(ee),i(M),i(te),i(L),i(ie),i($),i(ne),i(A)),i(p),ue(f,e),ue(y,e),ue(_,e)}}}const Ne='{"title":"Shiny on Spaces","local":"shiny-on-spaces","sections":[{"title":"Shiny for Python","local":"shiny-for-python","sections":[],"depth":2},{"title":"Shiny for R","local":"shiny-for-r","sections":[],"depth":2}],"depth":1}';function Ye(ce){return Fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Be extends qe{constructor(p){super(),ze(this,p,Ye,Ie,De,{})}}export{Be as component};
