Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -138,7 +138,29 @@ from shiny.ui import h2, tags
|
|
| 138 |
|
| 139 |
# Define the UI layout for the app
|
| 140 |
app_ui = ui.page_sidebar(
|
| 141 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
ui.tags.div(
|
| 143 |
{"style": "width:90%;margin: 0 auto;max-width: 1600px;"},
|
| 144 |
ui.tags.style(
|
|
@@ -162,43 +184,22 @@ app_ui = ui.page_sidebar(
|
|
| 162 |
ui.markdown("""
|
| 163 |
For ease of sharing, you can right-click (desktop) or press+hold (mobile) to save/copy the image.
|
| 164 |
"""),
|
| 165 |
-
),
|
| 166 |
-
|
| 167 |
-
# Sidebar content
|
| 168 |
-
ui.sidebar(
|
| 169 |
-
# Row for selecting season and level
|
| 170 |
-
ui.row(
|
| 171 |
-
ui.column(6, ui.input_select('year_input', 'Select Season', year_list, selected=2024)),
|
| 172 |
-
ui.column(6, ui.input_select('level_input', 'Select Level', level_dict)),
|
| 173 |
-
),
|
| 174 |
-
# Row for the action button to get player list
|
| 175 |
-
ui.row(ui.input_action_button("player_button", "Get Player List", class_="btn-primary")),
|
| 176 |
-
# Row for selecting the player
|
| 177 |
-
ui.row(ui.column(12, ui.output_ui('player_select_ui', 'Select Player'))),
|
| 178 |
-
|
| 179 |
-
ui.row(
|
| 180 |
-
ui.column(6, ui.input_switch("switch", "Custom Team?", False)),
|
| 181 |
-
ui.column(6, ui.input_select('logo_select', 'Select Custom Logo', image_dict_flip, multiple=False))
|
| 182 |
-
),
|
| 183 |
|
| 184 |
-
#
|
| 185 |
-
ui.
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
ui.output_text("status_pitcher"),
|
| 197 |
-
ui.output_plot('pitcher_plot', width='1200px', height='1200px')
|
| 198 |
-
),
|
| 199 |
-
id="tabset"
|
| 200 |
)
|
| 201 |
)
|
|
|
|
| 202 |
def server(input, output, session):
|
| 203 |
@render.ui
|
| 204 |
@reactive.event(input.player_button,input.tabset, ignore_none=False)
|
|
|
|
| 138 |
|
| 139 |
# Define the UI layout for the app
|
| 140 |
app_ui = ui.page_sidebar(
|
| 141 |
+
# Sidebar content
|
| 142 |
+
ui.sidebar(
|
| 143 |
+
# Row for selecting season and level
|
| 144 |
+
ui.row(
|
| 145 |
+
ui.column(6, ui.input_select('year_input', 'Select Season', year_list, selected=2024)),
|
| 146 |
+
ui.column(6, ui.input_select('level_input', 'Select Level', level_dict)),
|
| 147 |
+
),
|
| 148 |
+
# Row for the action button to get player list
|
| 149 |
+
ui.row(ui.input_action_button("player_button", "Get Player List", class_="btn-primary")),
|
| 150 |
+
# Row for selecting the player
|
| 151 |
+
ui.row(ui.column(12, ui.output_ui('player_select_ui', 'Select Player'))),
|
| 152 |
+
|
| 153 |
+
ui.row(
|
| 154 |
+
ui.column(6, ui.input_switch("switch", "Custom Team?", False)),
|
| 155 |
+
ui.column(6, ui.input_select('logo_select', 'Select Custom Logo', image_dict_flip, multiple=False))
|
| 156 |
+
),
|
| 157 |
+
|
| 158 |
+
# Row for the action button to generate plot
|
| 159 |
+
ui.row(ui.input_action_button("generate_plot", "Generate Plot", class_="btn-primary")),
|
| 160 |
+
width="400px"
|
| 161 |
+
),
|
| 162 |
+
|
| 163 |
+
# Main content area with header and tabs
|
| 164 |
ui.tags.div(
|
| 165 |
{"style": "width:90%;margin: 0 auto;max-width: 1600px;"},
|
| 166 |
ui.tags.style(
|
|
|
|
| 184 |
ui.markdown("""
|
| 185 |
For ease of sharing, you can right-click (desktop) or press+hold (mobile) to save/copy the image.
|
| 186 |
"""),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
+
# Tabs
|
| 189 |
+
ui.navset_tab(
|
| 190 |
+
ui.nav_panel("Batter Summary",
|
| 191 |
+
ui.output_text("status_batter"),
|
| 192 |
+
ui.output_plot('batter_plot', width='1200px', height='1200px')
|
| 193 |
+
),
|
| 194 |
+
ui.nav_panel("Pitcher Summary",
|
| 195 |
+
ui.output_text("status_pitcher"),
|
| 196 |
+
ui.output_plot('pitcher_plot', width='1200px', height='1200px')
|
| 197 |
+
),
|
| 198 |
+
id="tabset"
|
| 199 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
)
|
| 201 |
)
|
| 202 |
+
|
| 203 |
def server(input, output, session):
|
| 204 |
@render.ui
|
| 205 |
@reactive.event(input.player_button,input.tabset, ignore_none=False)
|