Spaces:
Sleeping
Sleeping
update leader info fix
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import pandas as pd
|
|
| 4 |
import os
|
| 5 |
import time
|
| 6 |
import datetime
|
| 7 |
-
from utils import fetch_competition_summary, fetch_models_evaluation, get_all_competition_summary,
|
| 8 |
# from dotenv import load_dotenv
|
| 9 |
from cfg import *
|
| 10 |
# load_dotenv()
|
|
@@ -28,7 +28,28 @@ else:
|
|
| 28 |
|
| 29 |
wandb_api = wandb.Api()
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
@st.cache_data()
|
| 34 |
def load_competition_data(last_update_time=None):
|
|
|
|
| 4 |
import os
|
| 5 |
import time
|
| 6 |
import datetime
|
| 7 |
+
from utils import fetch_competition_summary, fetch_models_evaluation, get_all_competition_summary, highlight_score_column
|
| 8 |
# from dotenv import load_dotenv
|
| 9 |
from cfg import *
|
| 10 |
# load_dotenv()
|
|
|
|
| 28 |
|
| 29 |
wandb_api = wandb.Api()
|
| 30 |
|
| 31 |
+
@st.cache_data
|
| 32 |
+
def update_leader_info(leader_info, competition, best_model):
|
| 33 |
+
if leader_info.get(competition) is None:
|
| 34 |
+
leader_info[competition] = {
|
| 35 |
+
"Username": best_model["Username"],
|
| 36 |
+
"Hotkey": best_model["Hotkey"],
|
| 37 |
+
"Date": time.strftime("%Y-%m-%d"),
|
| 38 |
+
"Days on Top": 1
|
| 39 |
+
}
|
| 40 |
+
else:
|
| 41 |
+
if leader_info[competition]["Hotkey"] == best_model["Hotkey"]:
|
| 42 |
+
# count the number of days on top
|
| 43 |
+
start_date = datetime.datetime.strptime(leader_info[competition]["Date"], "%Y-%m-%d")
|
| 44 |
+
current_date = datetime.datetime.now()
|
| 45 |
+
days_on_top = (current_date - start_date).days
|
| 46 |
+
leader_info[competition]["Days on Top"] = days_on_top + 1
|
| 47 |
+
else:
|
| 48 |
+
leader_info[competition]["Username"] = best_model["Username"]
|
| 49 |
+
leader_info[competition]["Hotkey"] = best_model["Hotkey"]
|
| 50 |
+
leader_info[competition]["Date"] = time.strftime("%Y-%m-%d")
|
| 51 |
+
leader_info[competition]["Days on Top"] = 1
|
| 52 |
+
return leader_info[competition]
|
| 53 |
|
| 54 |
@st.cache_data()
|
| 55 |
def load_competition_data(last_update_time=None):
|
utils.py
CHANGED
|
@@ -1,31 +1,11 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import wandb
|
|
|
|
| 4 |
from datetime import datetime
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
-
def update_leader_info(leader_info, competition, best_model):
|
| 9 |
-
current_date = datetime.now().strftime("%Y-%m-%d")
|
| 10 |
-
if leader_info.get(competition) is None:
|
| 11 |
-
leader_info[competition] = {
|
| 12 |
-
"Username": best_model["Username"],
|
| 13 |
-
"Hotkey": best_model["Hotkey"],
|
| 14 |
-
"Date": current_date,
|
| 15 |
-
"Days on Top": 1
|
| 16 |
-
}
|
| 17 |
-
else:
|
| 18 |
-
if leader_info[competition]["UID"] == best_model["ID"]:
|
| 19 |
-
leader_info[competition]["Days on Top"] += 1
|
| 20 |
-
else:
|
| 21 |
-
leader_info[competition] = {
|
| 22 |
-
"Username": best_model["Username"],
|
| 23 |
-
"Hotkey": best_model["Hotkey"],
|
| 24 |
-
"Date": current_date,
|
| 25 |
-
"Days on Top": 1
|
| 26 |
-
}
|
| 27 |
-
return leader_info[competition]
|
| 28 |
-
|
| 29 |
|
| 30 |
def get_all_competition_summary(api, projects):
|
| 31 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import wandb
|
| 4 |
+
import time
|
| 5 |
from datetime import datetime
|
| 6 |
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def get_all_competition_summary(api, projects):
|
| 11 |
|