New to using plumber API, trying to deploy R model, I have saved the R Model and a test data (OneRecord). Ran the plumber API from CMD line, 127.0.0.1:8000 returns Error "{"error":["500 - Internal server error"]}" and the terminal shows an error of "simpleError in if (opts$show.learner.output) identity else capture.output: argument is of length zero"
My R Code
#plumb_test.R
library(plumber)
#Simple msg command
#* @apiTitle Plumber Example API
#* Echo back the input
#* @param msg The message to echo
#* @get /echo
function(msg=""){
list(msg = paste0("The message is: '", msg, "'"))
}
#My Model
#* @get /run
function(){
rf_prediction <- predict(readRDS("rf_unwrap.rds"), newdata = as.data.frame(readRDS("Test_data.Rds")))
rf_prediction$data
}
R Code for plumber run
library(plumber)
pr <- plumb("plumb_test.R")
pr$run(port=8000)
msg working properly
http://127.0.0.1:8000/echo?msg=hellohru
returns me
{"msg":["The message is: 'hellohru'"]}
But my model returns
{"error":["500 - Internal server error"]}
in the terminal I am getting
> pr$run(port=8000)
Starting server to listen on port 8000
<simpleError in if (opts$show.learner.output) identity else capture.output: argument is of length zero>
I am running from windows cmd line as follows
C:\R\R-3.5.2\bin>r -f plumb_run.R
All the files were in bin folder (model, test data, plumb R scripts)
Expecting the output of prediction, not sure what the error means.