import{s as Fe,n as qe,o as ze}from"../chunks/scheduler.d6170356.js";import{S as Ue,i as je,g as a,s as l,r as se,A as Ie,h as s,f as i,c as o,j as De,u as re,x as r,k as pe,y as Ne,a as n,v as he,d as ue,t as fe,w as ce}from"../chunks/index.fcd4cc08.js";import{H as me,E as Ye}from"../chunks/index.c1f68a2b.js";function Ge(ye){let p,D,E,F,f,q,c,de=`<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.`,z,m,ge=`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.`,U,y,j,d,ve=`<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.`,I,g,we=`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.`,N,h,xe='<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg"/>',Y,v,be="<em>app.py</em>",G,w,Te=`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>.`,K,x,He="<em>Dockerfile</em>",O,b,_e=`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,T,Se="<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,_,Q,S,ke=`<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.`,V,$,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.`,X,u,Pe='<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg"/>',Z,k,Me=`<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>.`,ee,C,Le="<em>Dockerfile</em>",te,P,Re=`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>.`,ie,M,Ee="There are two main requirements for this Dockerfile:",ne,L,Ae='<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>',le,R,oe,A,ae;return f=new me({props:{title:"Shiny on Spaces",local:"shiny-on-spaces",headingTag:"h1"}}),y=new me({props:{title:"Shiny for Python",local:"shiny-for-python",headingTag:"h2"}}),_=new me({props:{title:"Shiny for R",local:"shiny-for-r",headingTag:"h2"}}),R=new Ye({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/spaces-sdks-docker-shiny.md"}}),{c(){p=a("meta"),D=l(),E=a("p"),F=l(),se(f.$$.fragment),q=l(),c=a("p"),c.innerHTML=de,z=l(),m=a("p"),m.textContent=ge,U=l(),se(y.$$.fragment),j=l(),d=a("p"),d.innerHTML=ve,I=l(),g=a("p"),g.textContent=we,N=l(),h=a("a"),h.innerHTML=xe,Y=l(),v=a("p"),v.innerHTML=be,G=l(),w=a("p"),w.innerHTML=Te,K=l(),x=a("p"),x.innerHTML=He,O=l(),b=a("p"),b.textContent=_e,W=l(),T=a("p"),T.innerHTML=Se,B=l(),H=a("p"),H.textContent=$e,J=l(),se(_.$$.fragment),Q=l(),S=a("p"),S.innerHTML=ke,V=l(),$=a("p"),$.textContent=Ce,X=l(),u=a("a"),u.innerHTML=Pe,Z=l(),k=a("p"),k.innerHTML=Me,ee=l(),C=a("p"),C.innerHTML=Le,te=l(),P=a("p"),P.innerHTML=Re,ie=l(),M=a("p"),M.textContent=Ee,ne=l(),L=a("ul"),L.innerHTML=Ae,le=l(),se(R.$$.fragment),oe=l(),A=a("p"),this.h()},l(e){const t=Ie("svelte-u9bgzb",document.head);p=s(t,"META",{name:!0,content:!0}),t.forEach(i),D=o(e),E=s(e,"P",{}),De(E).forEach(i),F=o(e),re(f.$$.fragment,e),q=o(e),c=s(e,"P",{"data-svelte-h":!0}),r(c)!=="svelte-1fyo2a7"&&(c.innerHTML=de),z=o(e),m=s(e,"P",{"data-svelte-h":!0}),r(m)!=="svelte-kcedpx"&&(m.textContent=ge),U=o(e),re(y.$$.fragment,e),j=o(e),d=s(e,"P",{"data-svelte-h":!0}),r(d)!=="svelte-186vj0b"&&(d.innerHTML=ve),I=o(e),g=s(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-8a31z"&&(g.textContent=we),N=o(e),h=s(e,"A",{href:!0,"data-svelte-h":!0}),r(h)!=="svelte-1pnrizg"&&(h.innerHTML=xe),Y=o(e),v=s(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-glwu2r"&&(v.innerHTML=be),G=o(e),w=s(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-1rp2ucx"&&(w.innerHTML=Te),K=o(e),x=s(e,"P",{"data-svelte-h":!0}),r(x)!=="svelte-1yl4y91"&&(x.innerHTML=He),O=o(e),b=s(e,"P",{"data-svelte-h":!0}),r(b)!=="svelte-16remnx"&&(b.textContent=_e),W=o(e),T=s(e,"P",{"data-svelte-h":!0}),r(T)!=="svelte-16lysqv"&&(T.innerHTML=Se),B=o(e),H=s(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-n6852g"&&(H.textContent=$e),J=o(e),re(_.$$.fragment,e),Q=o(e),S=s(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-18dos5d"&&(S.innerHTML=ke),V=o(e),$=s(e,"P",{"data-svelte-h":!0}),r($)!=="svelte-969v99"&&($.textContent=Ce),X=o(e),u=s(e,"A",{href:!0,"data-svelte-h":!0}),r(u)!=="svelte-3xytbo"&&(u.innerHTML=Pe),Z=o(e),k=s(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-1x3irtp"&&(k.innerHTML=Me),ee=o(e),C=s(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1yl4y91"&&(C.innerHTML=Le),te=o(e),P=s(e,"P",{"data-svelte-h":!0}),r(P)!=="svelte-1mqp5nr"&&(P.innerHTML=Re),ie=o(e),M=s(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-1szq3ka"&&(M.textContent=Ee),ne=o(e),L=s(e,"UL",{"data-svelte-h":!0}),r(L)!=="svelte-1ygyn9n"&&(L.innerHTML=Ae),le=o(e),re(R.$$.fragment,e),oe=o(e),A=s(e,"P",{}),De(A).forEach(i),this.h()},h(){pe(p,"name","hf:doc:metadata"),pe(p,"content",Ke),pe(h,"href","https://huggingface.co/new-space?template=posit/shiny-for-python-template"),pe(u,"href","https://huggingface.co/new-space?template=posit/shiny-for-r-template")},m(e,t){Ne(document.head,p),n(e,D,t),n(e,E,t),n(e,F,t),he(f,e,t),n(e,q,t),n(e,c,t),n(e,z,t),n(e,m,t),n(e,U,t),he(y,e,t),n(e,j,t),n(e,d,t),n(e,I,t),n(e,g,t),n(e,N,t),n(e,h,t),n(e,Y,t),n(e,v,t),n(e,G,t),n(e,w,t),n(e,K,t),n(e,x,t),n(e,O,t),n(e,b,t),n(e,W,t),n(e,T,t),n(e,B,t),n(e,H,t),n(e,J,t),he(_,e,t),n(e,Q,t),n(e,S,t),n(e,V,t),n(e,$,t),n(e,X,t),n(e,u,t),n(e,Z,t),n(e,k,t),n(e,ee,t),n(e,C,t),n(e,te,t),n(e,P,t),n(e,ie,t),n(e,M,t),n(e,ne,t),n(e,L,t),n(e,le,t),he(R,e,t),n(e,oe,t),n(e,A,t),ae=!0},p:qe,i(e){ae||(ue(f.$$.fragment,e),ue(y.$$.fragment,e),ue(_.$$.fragment,e),ue(R.$$.fragment,e),ae=!0)},o(e){fe(f.$$.fragment,e),fe(y.$$.fragment,e),fe(_.$$.fragment,e),fe(R.$$.fragment,e),ae=!1},d(e){e&&(i(D),i(E),i(F),i(q),i(c),i(z),i(m),i(U),i(j),i(d),i(I),i(g),i(N),i(h),i(Y),i(v),i(G),i(w),i(K),i(x),i(O),i(b),i(W),i(T),i(B),i(H),i(J),i(Q),i(S),i(V),i($),i(X),i(u),i(Z),i(k),i(ee),i(C),i(te),i(P),i(ie),i(M),i(ne),i(L),i(le),i(oe),i(A)),i(p),ce(f,e),ce(y,e),ce(_,e),ce(R,e)}}}const Ke='{"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 Oe(ye){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qe extends Ue{constructor(p){super(),je(this,p,Oe,Ge,Fe,{})}}export{Qe as component};
