-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.R
25 lines (20 loc) · 900 Bytes
/
deploy.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Create the workflow object, `simpsons_workflow`
source("R/create-model.R")
# Load a development version of vetiver.
# Alternatively, replace this with `library(vetiver)`
devtools::load_all("../vetiver-r/")
# Wrap the model with vetiver and test a prediction
simpsons_vetiver <- vetiver_model(simpsons_workflow, "simpsons")
predict(simpsons_vetiver, dplyr::tibble(episode_number = 1000))
# I'm censoring this as it's a public repo
# Whichever S3 bucket you choose, the eventual Lambda IAM role must have access
s3_bucket <- "CENSORED"
s3_board <- pins::board_s3(s3_bucket)
vetiver_pin_write(s3_board, simpsons_vetiver)
simpsons_vetiver$metadata$required_pkgs <- unique(c(
"knitr",
simpsons_vetiver$metadata$required_pkgs
))
# Create the `lambdr` `runtime.R` and Dockerfile
vetiver:::vetiver_write_lambda_runtime(s3_board, "simpsons")
vetiver:::vetiver_write_lambda_docker(simpsons_vetiver)