bulubula commited on
Commit
20a5acf
·
1 Parent(s): c2a3d61
Files changed (2) hide show
  1. app.py +12 -3
  2. playground.py +0 -16
app.py CHANGED
@@ -132,9 +132,18 @@ def main():
132
 
133
  best_hotkey = winning_hotkeys.idxmax()
134
 
135
- # get the best model with the winning hotkey
136
- best_model = model_evaluations[competition][model_evaluations[competition]["Hotkey"] == best_hotkey].iloc[0]
137
- st.session_state.leader_info[competition] = update_leader_info(st.session_state.leader_info, competition, best_model)
 
 
 
 
 
 
 
 
 
138
  else:
139
  st.session_state.leader_info[competition] = {
140
  "Username": "N/A", "Hotkey": "N/A",
 
132
 
133
  best_hotkey = winning_hotkeys.idxmax()
134
 
135
+ # Filter models for the best hotkey
136
+ best_model_filtered = model_evaluations[competition][model_evaluations[competition]["Hotkey"] == best_hotkey]
137
+
138
+ # Check if the filtered DataFrame is not empty
139
+ if not best_model_filtered.empty:
140
+ best_model = best_model_filtered.iloc[0]
141
+ st.session_state.leader_info[competition] = update_leader_info(st.session_state.leader_info, competition, best_model)
142
+ else:
143
+ st.warning(f"No model found for the best hotkey: {best_hotkey} in competition {competition}.")
144
+ # # get the best model with the winning hotkey
145
+ # best_model = model_evaluations[competition][model_evaluations[competition]["Hotkey"] == best_hotkey].iloc[0]
146
+ # st.session_state.leader_info[competition] = update_leader_info(st.session_state.leader_info, competition, best_model)
147
  else:
148
  st.session_state.leader_info[competition] = {
149
  "Username": "N/A", "Hotkey": "N/A",
playground.py DELETED
@@ -1,16 +0,0 @@
1
- # test idxmax() function
2
-
3
- import pandas as pd
4
-
5
- # Create a sample dataframe
6
- data = {
7
- "A": [1, 2, 3, 4, 5],
8
- "B": [10, 20, 30, 40, 50],
9
- "C": [100, 200, 300, 400, 500]
10
- }
11
-
12
- df = pd.DataFrame(data)
13
-
14
- # Find the index of the row with the maximum value in column "A"
15
- max_index = df["A"].idxmax()
16
- print(f"Index of the row with the maximum value in column 'A': {max_index}")