Spaces:
Running
Running
James McCool
commited on
Commit
·
b65158e
1
Parent(s):
9c4ce64
Refactor app.py to improve conditional rendering of session state data. Updated checks to ensure player summaries, overall simulations, individual game data, and opponent boosts are displayed only when the corresponding data is available. This change enhances user experience by preventing errors and improving clarity during simulations.
Browse files
app.py
CHANGED
@@ -692,11 +692,11 @@ if st.button("Run"):
|
|
692 |
|
693 |
tab1, tab2, tab3 = st.tabs(["Overall Data", "Individual Game Data", "Opponent Data"])
|
694 |
with tab1:
|
695 |
-
if 'player_summary'
|
696 |
st.subheader("Full Match Data")
|
697 |
st.dataframe(st.session_state.player_summary.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
|
698 |
|
699 |
-
if 'overall_sim_df'
|
700 |
st.subheader("Overall Simulations")
|
701 |
stat_tabs = st.tabs(["Kills", "Deaths", "Assists", "CS"])
|
702 |
|
@@ -747,11 +747,11 @@ with tab1:
|
|
747 |
)
|
748 |
|
749 |
with tab2:
|
750 |
-
if 'team_data'
|
751 |
st.subheader("Individual Game Data")
|
752 |
st.dataframe(st.session_state.team_data.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
|
753 |
|
754 |
-
if 'sim_df'
|
755 |
st.subheader("Individual Game Simulations")
|
756 |
unique_players = st.session_state.sim_df['Player'].unique().tolist()
|
757 |
player_tabs = st.tabs(unique_players)
|
@@ -767,6 +767,6 @@ with tab2:
|
|
767 |
)
|
768 |
|
769 |
with tab3:
|
770 |
-
if 'opp_boost'
|
771 |
st.subheader("Opponent Boosts")
|
772 |
st.dataframe(st.session_state.opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
|
|
692 |
|
693 |
tab1, tab2, tab3 = st.tabs(["Overall Data", "Individual Game Data", "Opponent Data"])
|
694 |
with tab1:
|
695 |
+
if 'player_summary' in st.session_state:
|
696 |
st.subheader("Full Match Data")
|
697 |
st.dataframe(st.session_state.player_summary.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
|
698 |
|
699 |
+
if 'overall_sim_df' in st.session_state:
|
700 |
st.subheader("Overall Simulations")
|
701 |
stat_tabs = st.tabs(["Kills", "Deaths", "Assists", "CS"])
|
702 |
|
|
|
747 |
)
|
748 |
|
749 |
with tab2:
|
750 |
+
if 'team_data' in st.session_state:
|
751 |
st.subheader("Individual Game Data")
|
752 |
st.dataframe(st.session_state.team_data.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(display_formats, precision=2), use_container_width = True)
|
753 |
|
754 |
+
if 'sim_df' in st.session_state:
|
755 |
st.subheader("Individual Game Simulations")
|
756 |
unique_players = st.session_state.sim_df['Player'].unique().tolist()
|
757 |
player_tabs = st.tabs(unique_players)
|
|
|
767 |
)
|
768 |
|
769 |
with tab3:
|
770 |
+
if 'opp_boost' in st.session_state:
|
771 |
st.subheader("Opponent Boosts")
|
772 |
st.dataframe(st.session_state.opp_boost.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|