Skip to content

Instantly share code, notes, and snippets.

@bart6114
Created November 24, 2015 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bart6114/f7c90a1916e0a75417f6 to your computer and use it in GitHub Desktop.
Save bart6114/f7c90a1916e0a75417f6 to your computer and use it in GitHub Desktop.
mpg_fit<-
readRDS("mpg_fit.Rdata")
predict_mpg<-function(disp, wt, hp){
new_data<-data.frame(disp=as.numeric(disp),
wt=as.numeric(wt),
hp=as.numeric(hp))
predict(mpg_fit, newdata = new_data)
}
library(jug)
jug() %>%
post("/mpg_api", decorate(predict_mpg)) %>%
simple_error_handler() %>%
serve_it()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment