Jimin Park commited on
Commit
a42f45f
·
1 Parent(s): bd8f083

added new structure

Browse files
Files changed (1) hide show
  1. util/app.py +14 -1
util/app.py CHANGED
@@ -132,7 +132,7 @@ def predict_top_5_champion_w_confidence(player_opgg_url, *champions):
132
  """Make prediction based on selected champions"""
133
 
134
  print("Selected Champions from Dropdowns:", champions)
135
-
136
  if not player_opgg_url or None in champions:
137
  return "Please fill in all fields"
138
 
@@ -158,6 +158,19 @@ def predict_top_5_champion_w_confidence(player_opgg_url, *champions):
158
  label_column = training_df['champion']
159
  predict_column = training_df.drop(columns=['champion', 'region'])
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  proba = model.predict_proba(predict_column)
162
 
163
  # Get top 5 indices and probabilities
 
132
  """Make prediction based on selected champions"""
133
 
134
  print("Selected Champions from Dropdowns:", champions)
135
+
136
  if not player_opgg_url or None in champions:
137
  return "Please fill in all fields"
138
 
 
158
  label_column = training_df['champion']
159
  predict_column = training_df.drop(columns=['champion', 'region'])
160
 
161
+ # Mapping dropdown selections to the correct columns
162
+ champ_columns = [
163
+ 'team_champ1', 'team_champ2', 'team_champ3', 'team_champ4',
164
+ 'opp_champ1', 'opp_champ2', 'opp_champ3', 'opp_champ4', 'opp_champ5'
165
+ ]
166
+
167
+ champion_converter = ChampionConverter()
168
+
169
+ # Update predict_column with user-selected champions
170
+ for col, champ_name in zip(champ_columns, champions):
171
+ champ_num = champion_converter.champion_to_num(champ_name)
172
+ predict_column.at[0, col] = champ_num
173
+
174
  proba = model.predict_proba(predict_column)
175
 
176
  # Get top 5 indices and probabilities