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