Shiny on Hugging Face

Deploy Shiny on Hugging Face with the click of a button

Gordon Shotwell


May 8, 2023

The Shiny hex next to the Hugging Face emoji logo

We’re thrilled to announce that we’ve partnered with Hugging Face to provide templated Spaces for both the R and Python Shiny packages. These Spaces allow you to deploy an R or Python Shiny app on Hugging Face with a click of a button, and make it easy to integrate Hugging Face models into your app.

About Hugging Face

Hugging Face is the most used open platform for AI, where the machine learning (ML) community has shared more than 150,000 models; 25,000 datasets; and 30,000 ML apps, including Stable Diffusion, Bloom, GPT-J, and open source ChatGPT alternatives. These apps enable the community to explore models, replicate results, and lower the barrier of entry for ML. At Posit, we’ve been extremely impressed with the Hugging Face community, and their commitment to supporting open source machine learning models.

What does Shiny add?

We think that Shiny is a great front-end for Hugging Face models because it is an efficient and developer-friendly GUI framework. Our reactive execution model allows Shiny to infer the relationships between inputs and outputs and minimally re-render application components. This means that you can quickly build intuitive and beautiful model demos without writing callback functions or caching data, and is particularly useful when calling expensive inference endpoints. Shiny is easy to learn, and there are great educational resources in both R and Python.

Shiny is great for simple demos, but it also has all of the tools you need to build complex, mission-critical applications. You can design delightful layouts and user interfaces, control application routing, and encapsulate and share components using modules.

Which Space should I use?

We have both R and Python templates available, so you can use your language of choice to write Shiny apps.

Most of the Hugging Face toolchain is built around Python, and as a result the Shiny for Python Space is a bit easier to use on Hugging Face. Shiny for Python is a pure python implementation of Shiny, and does not require an R installation. This means that Shiny for Python apps will deploy faster on Hugging Face infrastructure, and integrate better with their Python SDKs.

If you are an R user, or want to make use of some of the amazing R extensions, then the Shiny for R Space is an excellent option. To call Hugging Face tools we recommend communicating with Hugging Face using an API or calling one of their Python SDKs using reticulate.


Our mission at Posit is to support open-source scientific software, and so we’re very proud to support the effort to build advanced AI models under open-source licenses. We can’t wait to see what you build with this integration.