Hosting shiny app on Google Colab

The free plan of shinyapps.io is pretty limited, but Google Colab provides quite decent machines for free. I tried to run the example shiny app created by RStudio in a Google Colab notebook, but it didn't work. Here's the app:

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
        sidebarPanel(
            sliderInput("bins",
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)
        ),

        # Show a plot of the generated distribution
        mainPanel(
           plotOutput("distPlot")
        )
    )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')
    })
}

Then I ran

shinyApp(ui = ui, server = server, options = list(host = "0.0.0.0"))

Which gives the output

Listening on http://0.0.0.0:7444

But then I can't open the webpage with I clicked on the http://0.0.0.0:7444. Should the host be changed? Anyone also tried this?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.