-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.R
126 lines (108 loc) · 3.63 KB
/
global.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
source("R/data_prep.R")
source("R/palmAI.R")
source("R/support_functions.R")
library(shiny)
library(golem)
library(RCurl)
library(json64)
library(plotly)
# library(biomartr)
library(shinydashboard)
library(shinydashboardPlus)
library(shinythemes)
library(shinyBS)
library(reticulate)
library(httr)
#' Add external Resources to the Application
#'
#' This function is internally used to add external
#' resources inside the Shiny application.
#'
#' @import shiny
#' @importFrom golem add_resource_path activate_js favicon bundle_resources
#' @noRd
golem_add_external_resources <- function() {
add_resource_path(
"www", app_sys("app/www")
)
tags$head(
favicon(
ico = "icon",
rel = "shortcut icon",
resources_path = "www",
ext = "png"
),
bundle_resources(
path = app_sys("app/www"),
app_title = "AI Bot"
)
# Add here other external resources
# for example, you can add shinyalert::useShinyalert()
)
}
#' Access files in the current app
#'
#' NOTE: If you manually change your package name in the DESCRIPTION,
#' don't forget to change it here too, and in the config file.
#' For a safer name change mechanism, use the `golem::set_golem_name()` function.
#'
#' @param ... character vectors, specifying subdirectory and file(s)
#' within your package. The default, none, returns the root of the app.
#'
#' @noRd
app_sys <- function(...) {
system.file(..., package = "AIBot")
}
#' Read App Config
#'
#' @param value Value to retrieve from the config file.
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE.
#' If unset, "default".
#' @param use_parent Logical, scan the parent directory for config file.
#' @param file Location of the config file
#'
#' @noRd
get_golem_config <- function(
value,
config = Sys.getenv(
"GOLEM_CONFIG_ACTIVE",
Sys.getenv(
"R_CONFIG_ACTIVE",
"default"
)
),
use_parent = TRUE,
# Modify this if your config file is somewhere else
file = app_sys("golem-config.yml")
) {
config::get(
value = value,
config = config,
file = file,
use_parent = use_parent
)
}
demo_questions <- c(
'Example questions:' = "Example questions:",
'Lookup R package' = "List popular R packages for time-series forecast.",
'Explain concepts' = "What is Moran's I in spatial statistics?",
'Find statistic method' = "What statistics test should I use to examine the
correlation of two categorical variable?",
'How to, situation' = "How do you do regression when there are
predictor variables that are highly correlated?",
'How to, methods' = "How do you choose k in k-means clustering?",
'How to, evaluation' = "How do you assess linear regression models?",
'How to, outliers' = "How to deal with outliers?",
'How to, interpretation' = "What does P value = 0.02 mean in ANOVA?",
'Vague question, rejected' = "How does k-means clustering work?",
'Vague question, w/ context' = "How does k-means clustering work in statistics?"
)
demo_model_choose <- c('Choose Model: (Default: GPT-3.5 Turbo)',
'GPT-3.5 Turbo',
'Gemini 1.0 Pro')
demo_synth_prompts <- c('Example Text Prompts:' = "Example themes:",
'Medical note' = "Draft a clinical note for an Alzheimer's disease patient",
'Social Essay' = "Expected health disparities and racial inequality in the US in 2030")
img_prompts <- c('Example Image Prompts:' = "Example image prompts:",
'Healthy Control' = "2D sagittal MRI brain image of Healthy Asymptomatic Control",
'Patients' = "2D sagittal MRI brain image of Alzheimer's disease")