| | library(plumber) |
| | library(tidymodels) |
| | library(ranger) |
| | library(xgboost) |
| |
|
| | |
| | |
| | model <- readRDS("model.rds") |
| |
|
| | |
| |
|
| | |
| | |
| | function() { |
| | list(status = "ok", message = "Bank Marketing Model is Ready") |
| | } |
| |
|
| | |
| | |
| | |
| | function(req) { |
| | input_data <- jsonlite::fromJSON(req$postBody) |
| | |
| | |
| | if (!is.data.frame(input_data)) { |
| | input_data <- as.data.frame(input_data) |
| | } |
| | |
| | |
| | pred_class <- predict(model, input_data) %>% pull(.pred_class) |
| | pred_prob <- predict(model, input_data, type = "prob") %>% pull(.pred_Yes) |
| | |
| | list( |
| | prediction = pred_class, |
| | probability = pred_prob |
| | ) |
| | } |
| |
|