Spaces:
Sleeping
Sleeping
Jimin Park
commited on
Commit
·
3114e9c
1
Parent(s):
a42f45f
added new structure
Browse files- util/app.py +13 -5
util/app.py
CHANGED
@@ -94,6 +94,12 @@ def get_user_training_df(player_opgg_url):
|
|
94 |
|
95 |
def show_stats(player_opgg_url):
|
96 |
"""Display player statistics and recent matches"""
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
if not player_opgg_url:
|
98 |
return "Please enter a player link to OPGG", None
|
99 |
|
@@ -198,7 +204,6 @@ def predict_top_5_champion_w_confidence(player_opgg_url, *champions):
|
|
198 |
|
199 |
try:
|
200 |
|
201 |
-
|
202 |
def find_champion_rank(row):
|
203 |
true_champ = row['True_Champion']
|
204 |
for i in range(1, 6):
|
@@ -207,12 +212,15 @@ def predict_top_5_champion_w_confidence(player_opgg_url, *champions):
|
|
207 |
return 'Not in Top 5'
|
208 |
|
209 |
results['Prediction_Rank'] = results.apply(find_champion_rank, axis=1)
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
212 |
|
213 |
except Exception as e:
|
214 |
-
print(f"Error
|
215 |
-
# return f"Error: Could not map champion ID {decoded_numeric[0]}"
|
216 |
|
217 |
except Exception as e:
|
218 |
import traceback
|
|
|
94 |
|
95 |
def show_stats(player_opgg_url):
|
96 |
"""Display player statistics and recent matches"""
|
97 |
+
|
98 |
+
'''
|
99 |
+
to add: playstyle, role_specialization, champion_loyalty_score, most_champ_1, most_champ_2 ,
|
100 |
+
'''
|
101 |
+
|
102 |
+
|
103 |
if not player_opgg_url:
|
104 |
return "Please enter a player link to OPGG", None
|
105 |
|
|
|
204 |
|
205 |
try:
|
206 |
|
|
|
207 |
def find_champion_rank(row):
|
208 |
true_champ = row['True_Champion']
|
209 |
for i in range(1, 6):
|
|
|
212 |
return 'Not in Top 5'
|
213 |
|
214 |
results['Prediction_Rank'] = results.apply(find_champion_rank, axis=1)
|
215 |
+
# Select the last row and specific columns
|
216 |
+
latest_result = results.iloc[-1][["Rank_1_Champion", "Rank_2_Champion", "Rank_3_Champion"]]
|
217 |
+
|
218 |
+
print(latest_result)
|
219 |
+
|
220 |
+
return latest_result
|
221 |
|
222 |
except Exception as e:
|
223 |
+
print(f"Error getting top 5 champions: {e}")
|
|
|
224 |
|
225 |
except Exception as e:
|
226 |
import traceback
|