From 0367453ad7503ec62720faf16100d7b02dab3af3 Mon Sep 17 00:00:00 2001 From: Ross Armstrong <52817125+rossarmstrong@users.noreply.github.com> Date: Thu, 2 Feb 2023 21:17:40 +1100 Subject: [PATCH] Initial commit --- R/fct_get_url.R | 2 +- R/mod_create_image.R | 4 ++-- dev/02_dev.R | 2 +- tests/spelling.R | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/fct_get_url.R b/R/fct_get_url.R index b14d72f..847ba7a 100644 --- a/R/fct_get_url.R +++ b/R/fct_get_url.R @@ -9,6 +9,6 @@ get_url <- function(prompt, size){ openai::create_image(prompt = prompt, n = 1, size = size, - openai_api_key = Sys.getenv('OPENAI_API_KEY') + openai_api_key = Sys.getenv("OPENAI_API_KEY") )[["data"]][1,] } diff --git a/R/mod_create_image.R b/R/mod_create_image.R index e212245..1242579 100644 --- a/R/mod_create_image.R +++ b/R/mod_create_image.R @@ -33,9 +33,9 @@ mod_create_image_server <- function(id){ output$openaiResponse <- renderImage({ url <- get_url(input$createimage, input$imagesizes) filename <- paste("inst/app/www",get_filename(url), sep = "/") - download.file(url,filename, mode = 'wb') + download.file(url,filename, mode = "wb") img_dimension <- as.numeric(sapply(strsplit(input$imagesizes, "x"), getElement, 1)) - list(src = filename, contentType = 'image/png',width = img_dimension, height = img_dimension, + list(src = filename, contentType = "image/png",width = img_dimension, height = img_dimension, alt = input$createimage) }, deleteFile = FALSE) |> bindEvent(input$buttonCreateImage) diff --git a/dev/02_dev.R b/dev/02_dev.R index 6d7f7a8..3c0f5bc 100644 --- a/dev/02_dev.R +++ b/dev/02_dev.R @@ -16,7 +16,7 @@ ## Dependencies ---- ## Amend DESCRIPTION with dependencies read from package code parsing ## install.package('attachment') # if needed. # The s is missing on package/s -install.packages('attachment') +install.packages("attachment") attachment::att_amend_desc() ## Add one line by package you want to add as dependency" usethis::use_package("shinydashboard", min_version = TRUE) diff --git a/tests/spelling.R b/tests/spelling.R index 14bc897..33ef2c7 100644 --- a/tests/spelling.R +++ b/tests/spelling.R @@ -1,3 +1,3 @@ -if (requireNamespace('spelling', quietly = TRUE)) +if (requireNamespace("spelling", quietly = TRUE)) spelling::spell_check_test(vignettes = TRUE, error = FALSE, skip_on_cran = TRUE)