James McCool commited on
Commit
94f8ddd
·
1 Parent(s): 575b2cb

Refactor UI layout in app.py to enhance user experience. Updated the selection interface for teams, opponents, win/loss options, and prediction settings by organizing them into two-column layouts. This change improves the visual structure and accessibility of input fields, facilitating a more intuitive interaction for users when making predictions.

Browse files
Files changed (1) hide show
  1. app.py +41 -37
app.py CHANGED
@@ -59,49 +59,53 @@ with st.sidebar:
59
  max_value=max_date.date()
60
  )
61
 
62
- selected_team = st.selectbox(
63
- "Select Team",
64
- options=team_names,
65
- index=team_names.index("T1") if "T1" in team_names else 0
66
- )
67
-
68
- selected_opponent = st.selectbox(
69
- "Select Opponent",
70
- options=team_names,
71
- index=team_names.index("T1") if "T1" in team_names else 0
72
- )
 
 
73
 
74
-
75
- st.subheader("Prediction Settings")
76
- win_loss = st.selectbox(
77
- "Select Win/Loss",
78
- options=["Win", "Loss"],
79
- index=0
80
- )
81
-
82
- game_settings = st.selectbox(
83
- "Predict kills/deaths or use average?",
84
- options=["Average", "Predict"],
85
- index=0
86
- )
87
 
88
  if game_settings == "Average":
89
  kill_prediction = 0
90
  death_prediction = 0
91
  else:
92
- kill_prediction = st.number_input(
93
- "Predicted Team Kills",
94
- min_value=1,
95
- max_value=100,
96
- value=20
97
- )
98
-
99
- death_prediction = st.number_input(
100
- "Predicted Team Deaths",
101
- min_value=1,
102
- max_value=100,
103
- value=5
104
- )
 
 
105
 
106
  @st.cache_data(ttl = 60)
107
  def simulate_stats(row, num_sims=1000):
 
59
  max_value=max_date.date()
60
  )
61
 
62
+ col1, col2 = st.columns(2)
63
+ with col1:
64
+ selected_team = st.selectbox(
65
+ "Select Team",
66
+ options=team_names,
67
+ index=team_names.index("T1") if "T1" in team_names else 0
68
+ )
69
+ with col2:
70
+ selected_opponent = st.selectbox(
71
+ "Select Opponent",
72
+ options=team_names,
73
+ index=team_names.index("T1") if "T1" in team_names else 0
74
+ )
75
 
76
+ col1, col2 = st.columns(2)
77
+ with col1:
78
+ win_loss = st.selectbox(
79
+ "Select Win/Loss",
80
+ options=["Win", "Loss"],
81
+ index=0
82
+ )
83
+ with col2:
84
+ game_settings = st.selectbox(
85
+ "Predict kills/deaths or use average?",
86
+ options=["Average", "Predict"],
87
+ index=0
88
+ )
89
 
90
  if game_settings == "Average":
91
  kill_prediction = 0
92
  death_prediction = 0
93
  else:
94
+ col1, col2 = st.columns(2)
95
+ with col1:
96
+ kill_prediction = st.number_input(
97
+ "Predicted Team Kills",
98
+ min_value=1,
99
+ max_value=100,
100
+ value=20
101
+ )
102
+ with col2:
103
+ death_prediction = st.number_input(
104
+ "Predicted Team Deaths",
105
+ min_value=1,
106
+ max_value=100,
107
+ value=5
108
+ )
109
 
110
  @st.cache_data(ttl = 60)
111
  def simulate_stats(row, num_sims=1000):