Spaces:
Runtime error
Runtime error
Add handle condition for during model laoding.
Browse files
app.R
CHANGED
@@ -29,7 +29,7 @@ ui <- page_fillable(
|
|
29 |
layout_column_wrap(
|
30 |
width = 1/2,
|
31 |
textInput("prompt", label = NULL, width="100%"),
|
32 |
-
actionButton("send", "
|
33 |
)
|
34 |
)
|
35 |
|
@@ -83,6 +83,13 @@ server <- function(input, output, session) {
|
|
83 |
})
|
84 |
})
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
# Observer used at app startup time to allow using the 'Send' button once the
|
87 |
# model has been loaded.
|
88 |
observe({
|
@@ -90,6 +97,7 @@ server <- function(input, output, session) {
|
|
90 |
if (is.null(sess$is_loaded)) {
|
91 |
cat("Started loading model ....", "\n")
|
92 |
model_loaded <- sess$load_model(repo)
|
|
|
93 |
}
|
94 |
|
95 |
cat("Loading model:",sess$sess$poll_process(), "\n")
|
|
|
29 |
layout_column_wrap(
|
30 |
width = 1/2,
|
31 |
textInput("prompt", label = NULL, width="100%"),
|
32 |
+
actionButton("send", "Send", width = "100%")
|
33 |
)
|
34 |
)
|
35 |
|
|
|
83 |
})
|
84 |
})
|
85 |
|
86 |
+
observe({
|
87 |
+
# an observer that makes sure tasks are resolved during the shiny loop
|
88 |
+
invalidateLater(5000, session)
|
89 |
+
if (!is.null(sess$sess))
|
90 |
+
sess$sess$poll_process(1)
|
91 |
+
})
|
92 |
+
|
93 |
# Observer used at app startup time to allow using the 'Send' button once the
|
94 |
# model has been loaded.
|
95 |
observe({
|
|
|
97 |
if (is.null(sess$is_loaded)) {
|
98 |
cat("Started loading model ....", "\n")
|
99 |
model_loaded <- sess$load_model(repo)
|
100 |
+
sess$is_loaded <- FALSE # not yet loaded, but loading
|
101 |
}
|
102 |
|
103 |
cat("Loading model:",sess$sess$poll_process(), "\n")
|