Spaces:
Runtime error
Runtime error
Better message when failure.
Browse files
app.R
CHANGED
@@ -4,7 +4,8 @@ library(minhub)
|
|
4 |
library(magrittr)
|
5 |
source("model-session.R")
|
6 |
|
7 |
-
repo <- "stabilityai/stablelm-tuned-alpha-3b"
|
|
|
8 |
sess <- model_session$new()
|
9 |
model_loaded <- sess$load_model(repo)
|
10 |
|
@@ -86,19 +87,14 @@ server <- function(input, output, session) {
|
|
86 |
# Observer used at app startup time to allow using the 'Send' button once the
|
87 |
# model has been loaded.
|
88 |
observe({
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
shinyjs::enable("send")
|
98 |
-
updateActionButton(inputId = "send", label = "Send")
|
99 |
-
} else {
|
100 |
-
shinyjs::disable("send")
|
101 |
-
}
|
102 |
})
|
103 |
}
|
104 |
|
|
|
4 |
library(magrittr)
|
5 |
source("model-session.R")
|
6 |
|
7 |
+
#repo <- "stabilityai/stablelm-tuned-alpha-3b"
|
8 |
+
repo <- "EleutherAI/pythia-70m"
|
9 |
sess <- model_session$new()
|
10 |
model_loaded <- sess$load_model(repo)
|
11 |
|
|
|
87 |
# Observer used at app startup time to allow using the 'Send' button once the
|
88 |
# model has been loaded.
|
89 |
observe({
|
90 |
+
model_loaded %>%
|
91 |
+
promises::then(onFulfilled = function(x) {
|
92 |
+
shinyjs::enable("send")
|
93 |
+
updateActionButton(inputId = "send", label = "Send")
|
94 |
+
}, onRejected = function(x) {
|
95 |
+
shinyjs::disable("send")
|
96 |
+
insert_message(paste0("😭 Error loading the model:\n", as.character(x)))
|
97 |
+
})
|
|
|
|
|
|
|
|
|
|
|
98 |
})
|
99 |
}
|
100 |
|