Update app.R
Browse files
app.R
CHANGED
|
@@ -8,6 +8,7 @@ library(dplyr) # For data manipulation
|
|
| 8 |
library(httr)
|
| 9 |
library(patchwork) # For combining plots
|
| 10 |
|
|
|
|
| 11 |
download_private_csv <- function(repo_id, filename) {
|
| 12 |
url <- paste0("https://huggingface.co/spaces/", repo_id, "/resolve/main/", filename)
|
| 13 |
cat(url)
|
|
@@ -72,36 +73,35 @@ ui <- page_fluid(
|
|
| 72 |
theme = bs_theme(bg = "#333333", fg = "#ffffff", primary = "#428bca"),
|
| 73 |
|
| 74 |
card(
|
| 75 |
-
card_header("Player
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
dateRangeInput("date2", "Date Range:", start = "2024-02-09", end = "2024-09-05")
|
| 94 |
-
)
|
| 95 |
)
|
| 96 |
-
),
|
| 97 |
-
card(
|
| 98 |
-
downloadButton("download", "Download Plot", class = "btn-primary mb-3"),
|
| 99 |
-
plotOutput("combined_graph", height = "600px")
|
| 100 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
)
|
| 102 |
)
|
| 103 |
)
|
| 104 |
|
|
|
|
| 105 |
server <- function(input, output, session) {
|
| 106 |
pname <- reactiveVal()
|
| 107 |
|
|
|
|
| 8 |
library(httr)
|
| 9 |
library(patchwork) # For combining plots
|
| 10 |
|
| 11 |
+
# [Previous functions remain the same: download_private_csv, heatMap, and data loading]
|
| 12 |
download_private_csv <- function(repo_id, filename) {
|
| 13 |
url <- paste0("https://huggingface.co/spaces/", repo_id, "/resolve/main/", filename)
|
| 14 |
cat(url)
|
|
|
|
| 73 |
theme = bs_theme(bg = "#333333", fg = "#ffffff", primary = "#428bca"),
|
| 74 |
|
| 75 |
card(
|
| 76 |
+
card_header("Player Analysis Dashboard"),
|
| 77 |
+
card(
|
| 78 |
+
layout_columns(
|
| 79 |
+
col_widths = c(4, 4, 4),
|
| 80 |
+
card(
|
| 81 |
+
selectInput("league", "Select League:", choices = c("MLB","AAA","FSL")),
|
| 82 |
+
selectInput("player", "Select Player:", choices = c("")),
|
| 83 |
+
sliderInput("concen", "Heatmap Bandwidth", value = 1, step = 0.05, min = .5, max = 1.5)
|
| 84 |
+
),
|
| 85 |
+
card(
|
| 86 |
+
selectInput("hand1", "Batter Handedness", choices = c("All Batters","LHH","RHH")),
|
| 87 |
+
selectInput("pitch1", "Pitch:", choices = c("")),
|
| 88 |
+
dateRangeInput("date1", "Date Range:", start = "2024-02-09", end = "2024-09-05")
|
| 89 |
+
),
|
| 90 |
+
card(
|
| 91 |
+
selectInput("hand2", "Batter Handedness", choices = c("All Batters","LHH","RHH")),
|
| 92 |
+
selectInput("pitch2", "Pitch:", choices = c("")),
|
| 93 |
+
dateRangeInput("date2", "Date Range:", start = "2024-02-09", end = "2024-09-05")
|
|
|
|
|
|
|
| 94 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
)
|
| 96 |
+
),
|
| 97 |
+
card(
|
| 98 |
+
downloadButton("download", "Download Plot", class = "btn-primary mb-3"),
|
| 99 |
+
plotOutput("combined_graph", height = "600px")
|
| 100 |
)
|
| 101 |
)
|
| 102 |
)
|
| 103 |
|
| 104 |
+
# [Server code remains exactly the same]
|
| 105 |
server <- function(input, output, session) {
|
| 106 |
pname <- reactiveVal()
|
| 107 |
|