Spaces:
Sleeping
Sleeping
czasfixhope
Browse files
app.py
CHANGED
|
@@ -35,23 +35,23 @@ def update_leader_info(
|
|
| 35 |
competition: str,
|
| 36 |
best_model: Dict[str, Any]
|
| 37 |
) -> Dict[str, Any]:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
if leader_info.get(competition) is None:
|
| 39 |
leader_info[competition] = {
|
| 40 |
"Miner hotkey": best_model["Miner hotkey"],
|
| 41 |
-
"Date":
|
| 42 |
-
|
| 43 |
}
|
| 44 |
else:
|
| 45 |
if leader_info[competition]["Miner hotkey"] == best_model["Miner hotkey"]:
|
| 46 |
-
|
| 47 |
-
start_date = datetime.datetime.strptime(leader_info[competition]["Date"], "%Y-%m-%d")
|
| 48 |
-
current_date = datetime.datetime.now()
|
| 49 |
-
days_on_top = (current_date - start_date).days
|
| 50 |
-
# leader_info[competition]["Days on Top"] = days_on_top + 1
|
| 51 |
else:
|
| 52 |
leader_info[competition]["Miner hotkey"] = best_model["Miner hotkey"]
|
| 53 |
-
leader_info[competition]["Date"] =
|
| 54 |
-
|
| 55 |
return leader_info[competition]
|
| 56 |
|
| 57 |
@st.cache_data()
|
|
@@ -105,7 +105,7 @@ def main():
|
|
| 105 |
st.session_state.leader_info[competition] = {
|
| 106 |
"Miner hotkey": "N/A",
|
| 107 |
"Date": "N/A",
|
| 108 |
-
|
| 109 |
}
|
| 110 |
else:
|
| 111 |
competition_summaries, model_evaluations, _ = load_competition_data(st.session_state.last_update_time)
|
|
@@ -115,8 +115,8 @@ def main():
|
|
| 115 |
st.write("#### Select a competition to view more details and rankings.")
|
| 116 |
|
| 117 |
# Create a header for the table
|
| 118 |
-
cols = st.columns([1, 3, 2, 2, 3])
|
| 119 |
-
headers = ["Index", "Competition Name", "Date", "Miner hotkey"]
|
| 120 |
for col, header in zip(cols, headers):
|
| 121 |
col.write(header)
|
| 122 |
|
|
@@ -125,14 +125,14 @@ def main():
|
|
| 125 |
|
| 126 |
leader_info = st.session_state.get("leader_info", {}).get(competition, {})
|
| 127 |
|
| 128 |
-
cols = st.columns([1, 3, 2, 2, 3])
|
| 129 |
cols[0].write(index)
|
| 130 |
|
| 131 |
if cols[1].button(competition):
|
| 132 |
st.session_state.selected_competition = competition
|
| 133 |
cols[2].write(leader_info.get("Date", "N/A"))
|
| 134 |
cols[3].write(leader_info.get("Miner hotkey", "N/A"))
|
| 135 |
-
|
| 136 |
if st.session_state.selected_competition:
|
| 137 |
competition_name = st.session_state.selected_competition
|
| 138 |
|
|
|
|
| 35 |
competition: str,
|
| 36 |
best_model: Dict[str, Any]
|
| 37 |
) -> Dict[str, Any]:
|
| 38 |
+
start_date = datetime.datetime.strptime(best_model["Created At"], "%Y-%m-%d %H:%M:%S")
|
| 39 |
+
current_date = datetime.datetime.now()
|
| 40 |
+
days_on_top = (current_date - start_date).days
|
| 41 |
+
|
| 42 |
if leader_info.get(competition) is None:
|
| 43 |
leader_info[competition] = {
|
| 44 |
"Miner hotkey": best_model["Miner hotkey"],
|
| 45 |
+
"Date": start_date,
|
| 46 |
+
"Days on Top": days_on_top,
|
| 47 |
}
|
| 48 |
else:
|
| 49 |
if leader_info[competition]["Miner hotkey"] == best_model["Miner hotkey"]:
|
| 50 |
+
leader_info[competition]["Days on Top"] += days_on_top
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
else:
|
| 52 |
leader_info[competition]["Miner hotkey"] = best_model["Miner hotkey"]
|
| 53 |
+
leader_info[competition]["Date"] = start_date
|
| 54 |
+
leader_info[competition]["Days on Top"] = days_on_top
|
| 55 |
return leader_info[competition]
|
| 56 |
|
| 57 |
@st.cache_data()
|
|
|
|
| 105 |
st.session_state.leader_info[competition] = {
|
| 106 |
"Miner hotkey": "N/A",
|
| 107 |
"Date": "N/A",
|
| 108 |
+
"Days on Top": "N/A"
|
| 109 |
}
|
| 110 |
else:
|
| 111 |
competition_summaries, model_evaluations, _ = load_competition_data(st.session_state.last_update_time)
|
|
|
|
| 115 |
st.write("#### Select a competition to view more details and rankings.")
|
| 116 |
|
| 117 |
# Create a header for the table
|
| 118 |
+
cols = st.columns([1, 3, 2, 2, 3, 1])
|
| 119 |
+
headers = ["Index", "Competition Name", "Date", "Miner hotkey", "Days on Top"]
|
| 120 |
for col, header in zip(cols, headers):
|
| 121 |
col.write(header)
|
| 122 |
|
|
|
|
| 125 |
|
| 126 |
leader_info = st.session_state.get("leader_info", {}).get(competition, {})
|
| 127 |
|
| 128 |
+
cols = st.columns([1, 3, 2, 2, 3, 1])
|
| 129 |
cols[0].write(index)
|
| 130 |
|
| 131 |
if cols[1].button(competition):
|
| 132 |
st.session_state.selected_competition = competition
|
| 133 |
cols[2].write(leader_info.get("Date", "N/A"))
|
| 134 |
cols[3].write(leader_info.get("Miner hotkey", "N/A"))
|
| 135 |
+
cols[4].write(leader_info.get("Days on Top", "N/A"))
|
| 136 |
if st.session_state.selected_competition:
|
| 137 |
competition_name = st.session_state.selected_competition
|
| 138 |
|