Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -188,8 +188,11 @@ download_private_rds <- function(repo_id, filename) {
|
|
| 188 |
}
|
| 189 |
|
| 190 |
stuffplus_recipe <- download_private_rds("CoastalBaseball/PitcherAppFiles", "stuffplus_recipe.rds")
|
|
|
|
| 191 |
stuffplus_model <- xgb.load("stuffplus_xgb.json")
|
| 192 |
|
|
|
|
|
|
|
| 193 |
process_dataset <- function(df) {
|
| 194 |
if ("Batter" %in% names(df)) {
|
| 195 |
df <- df %>% mutate(Batter = stringr::str_replace(Batter, "^\\s*(\\w+)\\s*,\\s*(\\w+)\\s*$", "\\2 \\1"))
|
|
@@ -3274,13 +3277,6 @@ has_col_index <- function(idx) {
|
|
| 3274 |
is.numeric(idx) && length(idx) == 1 && !is.na(idx) && is.finite(idx) && idx >= 1
|
| 3275 |
}
|
| 3276 |
|
| 3277 |
-
|
| 3278 |
-
stuffplus_model <- tryCatch({
|
| 3279 |
-
readr::read_rds("new_stuffplus_model.rds")
|
| 3280 |
-
}, error = function(e) {
|
| 3281 |
-
message("Stuff+ model not found. Predictions will be unavailable.")
|
| 3282 |
-
NULL
|
| 3283 |
-
})
|
| 3284 |
|
| 3285 |
reference_data_for_stuff <- tryCatch({
|
| 3286 |
message("Loading reference data for Stuff+ standardization...")
|
|
|
|
| 188 |
}
|
| 189 |
|
| 190 |
stuffplus_recipe <- download_private_rds("CoastalBaseball/PitcherAppFiles", "stuffplus_recipe.rds")
|
| 191 |
+
|
| 192 |
stuffplus_model <- xgb.load("stuffplus_xgb.json")
|
| 193 |
|
| 194 |
+
message(class(stuffplus_model))
|
| 195 |
+
|
| 196 |
process_dataset <- function(df) {
|
| 197 |
if ("Batter" %in% names(df)) {
|
| 198 |
df <- df %>% mutate(Batter = stringr::str_replace(Batter, "^\\s*(\\w+)\\s*,\\s*(\\w+)\\s*$", "\\2 \\1"))
|
|
|
|
| 3277 |
is.numeric(idx) && length(idx) == 1 && !is.na(idx) && is.finite(idx) && idx >= 1
|
| 3278 |
}
|
| 3279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3280 |
|
| 3281 |
reference_data_for_stuff <- tryCatch({
|
| 3282 |
message("Loading reference data for Stuff+ standardization...")
|