tests/testthat/dummy_score.R

#' Copyright (c) Microsoft Corporation. All rights reserved.
#' Licensed under the MIT License.

library(jsonlite)

init <- function()
{
  model_path <- Sys.getenv("AZUREML_MODEL_DIR")
  model <- readRDS(file.path(model_path, "model.rds"))
  message("model is loaded")
  
  function(data)
  {
    plant <- as.data.frame(fromJSON(data))
    prediction <- predict(model, plant)
    result <- as.character(prediction)
    toJSON(result)
  }
}

Try the azuremlsdk package in your browser

Any scripts or data that you put into this service are public.

azuremlsdk documentation built on Oct. 23, 2020, 8:22 p.m.