dcrey7 commited on
Commit
286093e
·
1 Parent(s): 38d5ce4

fifa19_streamlit

Browse files
Files changed (1) hide show
  1. app.py +40 -39
app.py CHANGED
@@ -121,30 +121,32 @@ def final_pred(num_of_players,b=[],c=[],d=[]):
121
  def main():
122
  st.title("FIFA 19 Player Recommender 🎮⚽")
123
 
124
- # Add business context and description
125
- st.markdown("""
126
- ### About this App
127
- This FIFA 19 Player Recommender helps football clubs and managers identify similar players and predict their market value.
128
- It's particularly useful for:
129
- - Scouting potential replacements for current players
130
- - Finding undervalued talents in the market
131
- - Discovering players that match your team's playing style
132
- - Making informed decisions about player acquisitions
133
 
134
- ### How it Works
135
- 1. The app uses advanced machine learning to analyze player attributes and find similar players
136
- 2. It considers over 70 different player statistics and characteristics
137
- 3. Provides market value predictions to help with transfer budget planning
138
-
139
- ### How to Use
140
- 1. **Select Your Team** from the sidebar - this helps find players that would fit your team's style
141
- 2. **Choose Position** you're looking to fill
142
- 3. **Adjust Number of Recommendations** (1-10 players)
143
- 4. **Set Maximum Age** to focus on your preferred age range
144
- 5. Click "Get Recommendations" to see your matches!
145
-
146
- ---
147
- """)
 
 
 
 
 
 
 
 
 
148
 
149
  # Sidebar inputs
150
  st.sidebar.header("Search Parameters")
@@ -159,22 +161,21 @@ def main():
159
  age_up = st.sidebar.slider("Maximum Age", 16, 45, 30)
160
 
161
  if st.sidebar.button("Get Recommendations"):
162
- with st.spinner("Finding similar players..."):
163
- recommendations = player_sim_team(team_chosen, postion_chosen, num_of_players, age_up)
164
-
165
- # Display results in a nice format
166
- st.subheader(f"Recommended Players for {team_chosen} - {postion_chosen}")
167
-
168
- # Create columns for each player
169
- cols = st.columns(min(3, len(recommendations)))
170
- for idx, player in enumerate(recommendations):
171
- col_idx = idx % 3
172
- with cols[col_idx]:
173
- st.markdown(f"""
174
- #### {player['player_name']}
175
- **Estimated Value:** €{player['starting_bid']:,.2f}
176
- ---
177
- """)
178
 
179
  if __name__ == '__main__':
180
  main()
 
121
  def main():
122
  st.title("FIFA 19 Player Recommender 🎮⚽")
123
 
124
+ # Create two columns - one for instructions and one for results
125
+ left_col, right_col = st.columns([1, 1])
 
 
 
 
 
 
 
126
 
127
+ with left_col:
128
+ # Add business context and description
129
+ st.markdown("""
130
+ ### About this App
131
+ This FIFA 19 Player Recommender helps football clubs and managers identify similar players and predict their market value.
132
+ It's particularly useful for:
133
+ - Scouting potential replacements for current players
134
+ - Finding undervalued talents in the market
135
+ - Discovering players that match your team's playing style
136
+ - Making informed decisions about player acquisitions
137
+
138
+ ### How it Works
139
+ 1. The app uses advanced machine learning to analyze player attributes and find similar players
140
+ 2. It considers over 70 different player statistics and characteristics
141
+ 3. Provides market value predictions to help with transfer budget planning
142
+
143
+ ### How to Use
144
+ 1. **Select Your Team** from the sidebar - this helps find players that would fit your team's style
145
+ 2. **Choose Position** you're looking to fill
146
+ 3. **Adjust Number of Recommendations** (1-10 players)
147
+ 4. **Set Maximum Age** to focus on your preferred age range
148
+ 5. Click "Get Recommendations" to see your matches!
149
+ """)
150
 
151
  # Sidebar inputs
152
  st.sidebar.header("Search Parameters")
 
161
  age_up = st.sidebar.slider("Maximum Age", 16, 45, 30)
162
 
163
  if st.sidebar.button("Get Recommendations"):
164
+ with right_col:
165
+ with st.spinner("Finding similar players..."):
166
+ recommendations = player_sim_team(team_chosen, postion_chosen, num_of_players, age_up)
167
+
168
+ # Display results in a nice format
169
+ st.subheader(f"Recommended Players for {team_chosen} - {postion_chosen}")
170
+
171
+ # Create a container for recommendations
172
+ for player in recommendations:
173
+ with st.container():
174
+ st.markdown(f"""
175
+ ### {player['player_name']}
176
+ **Estimated Value:** €{player['starting_bid']:,.2f}
177
+ ---
178
+ """)
 
179
 
180
  if __name__ == '__main__':
181
  main()