i am not sure what is wrong with the below code. I am not able to run the below python code
ui.R file..........................................
library(shiny)
library(shinydashboard)
library(reticulate)
ui <- dashboardPage(
dashboardHeader(disable = TRUE),
dashboardSidebar(disable = TRUE),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(actionButton("upload","Upload",width = 150),
actionButton("clear_upload","Clear",width = 150),
verbatimTextOutput("code"))
)
)
)
server.R file
server <- function(input, output) {
get_code <- eventReactive(input$upload,{
py_run_string("def add(x, y):return x + (y+12)")
py_run_string("print(add(5,1))")
})
observeEvent(input$upload, {
output$code <- renderPrint(get_code())
})
observeEvent(input$clear_upload, {
output$code <- renderPrint("")
})
}