Spaces:
Sleeping
Sleeping
Jimin Park
commited on
Commit
·
ccc2ebe
1
Parent(s):
34090f6
added new structure
Browse files- util/app.py +25 -27
util/app.py
CHANGED
@@ -121,37 +121,37 @@ def show_stats(player_opgg_url):
|
|
121 |
.index.tolist()
|
122 |
)
|
123 |
|
124 |
-
print("training_features['playstyle']: \n", training_features['playstyle'])
|
125 |
-
|
126 |
-
print("training_features['role_specialization]: \n", training_features['role_specialization'])
|
127 |
# print("training_features: \n", training_features[champion])
|
128 |
|
129 |
# Extract additional stats
|
130 |
-
playstyle = training_features['playstyle'].mode()[0] if 'playstyle' in training_features else 'N/A'
|
131 |
-
print("processed playstyle.\n")
|
132 |
-
role_specialization = training_features['role_specialization'].mode()[0] if 'role_specialization' in training_features else 'N/A' # Most common role
|
133 |
-
print("processed role_specialization.\n")
|
134 |
#champion_loyalty_score = training_features['champion_loyalty_score'].mean().round(2) if 'champion_loyalty_score' in training_features else 'N/A' # Average loyalty
|
135 |
# print("processed champion_loyalty_score.\n")
|
136 |
|
137 |
# Map numeric playstyle to descriptive text
|
138 |
-
playstyle_mapping = {
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
}
|
146 |
|
147 |
-
role_specialization_map = {
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
}
|
155 |
|
156 |
stats_html = f"""
|
157 |
<div style='padding: 20px; background: #f5f5f5; border-radius: 10px;'>
|
@@ -159,12 +159,10 @@ def show_stats(player_opgg_url):
|
|
159 |
<p>Wins: {wins} | Losses: {losses}</p>
|
160 |
<p>Winrate: {winrate}</p>
|
161 |
<p>Favorite Champions: {', '.join(favorite_champions)}</p>
|
162 |
-
<p>Playstyle: {playstyle_mapping.get(playstyle, 'N/A')}</p>
|
163 |
-
<p>Role Specialization: {role_specialization_map.get(role_specialization, 'N/A')}</p>
|
164 |
</div>
|
165 |
"""
|
166 |
-
|
167 |
-
#
|
168 |
# <p>Champion Loyalty Score: {champion_loyalty_score}</p>
|
169 |
|
170 |
return stats_html, None
|
|
|
121 |
.index.tolist()
|
122 |
)
|
123 |
|
124 |
+
# print("training_features['playstyle']: \n", training_features['playstyle'])
|
125 |
+
|
126 |
+
# print("training_features['role_specialization]: \n", training_features['role_specialization'])
|
127 |
# print("training_features: \n", training_features[champion])
|
128 |
|
129 |
# Extract additional stats
|
130 |
+
# playstyle = training_features['playstyle'].mode()[0] if 'playstyle' in training_features else 'N/A'
|
131 |
+
# print("processed playstyle.\n")
|
132 |
+
# role_specialization = training_features['role_specialization'].mode()[0] if 'role_specialization' in training_features else 'N/A' # Most common role
|
133 |
+
# print("processed role_specialization.\n")
|
134 |
#champion_loyalty_score = training_features['champion_loyalty_score'].mean().round(2) if 'champion_loyalty_score' in training_features else 'N/A' # Average loyalty
|
135 |
# print("processed champion_loyalty_score.\n")
|
136 |
|
137 |
# Map numeric playstyle to descriptive text
|
138 |
+
# playstyle_mapping = {
|
139 |
+
# 0: "Assassin/Carry",
|
140 |
+
# 1: "Support/Utility",
|
141 |
+
# 2: "Tank/Initiator",
|
142 |
+
# 3: "Split-pusher",
|
143 |
+
# 4: "Aggressive/Fighter",
|
144 |
+
# 5: "Undefined"
|
145 |
+
# }
|
146 |
|
147 |
+
# role_specialization_map = {
|
148 |
+
# 0: "Pure Specialist",
|
149 |
+
# 1: "Strong Dual Role",
|
150 |
+
# 2: "Primary Role with Backups",
|
151 |
+
# 3: "Role Swapper",
|
152 |
+
# 4: "True Flex",
|
153 |
+
# 5: "Undefined"
|
154 |
+
# }
|
155 |
|
156 |
stats_html = f"""
|
157 |
<div style='padding: 20px; background: #f5f5f5; border-radius: 10px;'>
|
|
|
159 |
<p>Wins: {wins} | Losses: {losses}</p>
|
160 |
<p>Winrate: {winrate}</p>
|
161 |
<p>Favorite Champions: {', '.join(favorite_champions)}</p>
|
|
|
|
|
162 |
</div>
|
163 |
"""
|
164 |
+
# <p>Playstyle: {playstyle_mapping.get(playstyle, 'N/A')}</p>
|
165 |
+
# <p>Role Specialization: {role_specialization_map.get(role_specialization, 'N/A')}</p>
|
166 |
# <p>Champion Loyalty Score: {champion_loyalty_score}</p>
|
167 |
|
168 |
return stats_html, None
|