Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -164,31 +164,7 @@ app_css <- "
|
|
| 164 |
"
|
| 165 |
|
| 166 |
|
| 167 |
-
|
| 168 |
-
url <- paste0("https://huggingface.co/datasets/", repo_id, "/resolve/main/", filename)
|
| 169 |
-
|
| 170 |
-
api_key <- Sys.getenv("HFToken")
|
| 171 |
-
|
| 172 |
-
if (api_key == "") {
|
| 173 |
-
stop("API key is not set.")
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
response <- GET(url, add_headers(Authorization = paste("Bearer", api_key)))
|
| 177 |
-
|
| 178 |
-
if (status_code(response) == 200) {
|
| 179 |
-
temp_file <- tempfile(fileext = ".rds")
|
| 180 |
-
|
| 181 |
-
writeBin(content(response, "raw"), temp_file)
|
| 182 |
-
|
| 183 |
-
data <- readRDS(temp_file)
|
| 184 |
-
|
| 185 |
-
return(data)
|
| 186 |
-
} else {
|
| 187 |
-
stop(paste("Failed to download dataset. Status code:", status_code(response)))
|
| 188 |
-
}
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
stuffplus_recipe <- download_private_rds("CoastalBaseball/PitcherAppFiles", "stuffplus_recipe.rds")
|
| 192 |
|
| 193 |
stuffplus_model <- xgb.load("stuffplus_xgb.json")
|
| 194 |
|
|
|
|
| 164 |
"
|
| 165 |
|
| 166 |
|
| 167 |
+
stuffplus_recipe <- read_rds("stuffplus_recipe.rds")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
stuffplus_model <- xgb.load("stuffplus_xgb.json")
|
| 170 |
|