if (!require(fs, quietly = TRUE)) {
install.packages("fs")
}
if (!require(fs))
stop("fs was not correctly installed?")
if (dir.exists("csrc")) {
cat("Building styleganr torch plugins .... \n")
if (!fs::dir_exists("csrc/build"))
fs::dir_create("csrc/build")
withr::with_dir("csrc/build", {
system("cmake ..")
system("cmake --build . --target package --config Release --parallel 8")
message("copying libraries ...")
system("cmake --install .")
})
# # copy lantern
# source("R/lantern_sync.R")
# lantern_sync(TRUE)
#
# # download torch
# source("R/install.R")
# install_torch(path = normalizePath("deps/"), load = FALSE)
#
# # copy deps to inst
# if (fs::dir_exists("inst/deps"))
# fs::dir_delete("inst/deps/")
#
# fs::dir_copy("deps/", new_path = "inst/deps/")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.