Spaces:
Sleeping
Sleeping
remove all competition summary
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import os
|
|
| 5 |
import time
|
| 6 |
import datetime
|
| 7 |
from typing import Dict, Any
|
| 8 |
-
from utils import fetch_competition_summary, fetch_models_evaluation,
|
| 9 |
# from dotenv import load_dotenv
|
| 10 |
from cfg import *
|
| 11 |
# load_dotenv()
|
|
@@ -107,17 +107,6 @@ def main():
|
|
| 107 |
else:
|
| 108 |
competition_summaries, model_evaluations, _ = load_competition_data(st.session_state.last_update_time)
|
| 109 |
|
| 110 |
-
number_of_competitions, number_of_runs = get_all_competition_summary(wandb_api, COMPETITIONS)
|
| 111 |
-
last_updated = datetime.datetime.fromtimestamp(st.session_state.last_update_time).strftime('%Y-%m-%d %H:%M:%S')
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
st.subheader("Summary information")
|
| 115 |
-
table_html = competition_summary_table(number_of_competitions, number_of_runs, last_updated)
|
| 116 |
-
|
| 117 |
-
# Render the table using st.markdown
|
| 118 |
-
st.markdown(table_html, unsafe_allow_html=True)
|
| 119 |
-
|
| 120 |
-
|
| 121 |
st.subheader("###")
|
| 122 |
st.markdown("<h2 style='text-align: center; font-size: 28px;'>Competitions</h2>", unsafe_allow_html=True)
|
| 123 |
st.write("#### Select a competition to view more details and rankings.")
|
|
|
|
| 5 |
import time
|
| 6 |
import datetime
|
| 7 |
from typing import Dict, Any
|
| 8 |
+
from utils import fetch_competition_summary, fetch_models_evaluation, highlight_score_column
|
| 9 |
# from dotenv import load_dotenv
|
| 10 |
from cfg import *
|
| 11 |
# load_dotenv()
|
|
|
|
| 107 |
else:
|
| 108 |
competition_summaries, model_evaluations, _ = load_competition_data(st.session_state.last_update_time)
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
st.subheader("###")
|
| 111 |
st.markdown("<h2 style='text-align: center; font-size: 28px;'>Competitions</h2>", unsafe_allow_html=True)
|
| 112 |
st.write("#### Select a competition to view more details and rankings.")
|
utils.py
CHANGED
|
@@ -5,22 +5,6 @@ import time
|
|
| 5 |
from datetime import datetime
|
| 6 |
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
def get_all_competition_summary(api, projects):
|
| 11 |
-
|
| 12 |
-
number_of_competitions = 0
|
| 13 |
-
number_of_runs = 0
|
| 14 |
-
|
| 15 |
-
for project in projects:
|
| 16 |
-
entity = projects[project]["entity"]
|
| 17 |
-
project_name = projects[project]["project"]
|
| 18 |
-
runs = api.runs(f"{entity}/{project_name}")
|
| 19 |
-
number_of_competitions += 1
|
| 20 |
-
number_of_runs += len(runs)
|
| 21 |
-
|
| 22 |
-
return number_of_competitions,number_of_runs
|
| 23 |
-
|
| 24 |
def fetch_competition_summary(api, projects, selected_project):
|
| 25 |
data = []
|
| 26 |
|
|
@@ -89,24 +73,6 @@ def fetch_models_evaluation(api, projects, selected_project):
|
|
| 89 |
|
| 90 |
return df
|
| 91 |
|
| 92 |
-
def competition_summary_table(number_of_competitions, number_of_runs, last_updated):
|
| 93 |
-
return f"""
|
| 94 |
-
<div class="table-container">
|
| 95 |
-
<table class="summary-table">
|
| 96 |
-
<tr>
|
| 97 |
-
<th>Number of competitions</th>
|
| 98 |
-
<th>Number of models run</th>
|
| 99 |
-
<th>Last updated</th>
|
| 100 |
-
</tr>
|
| 101 |
-
<tr>
|
| 102 |
-
<td>{number_of_competitions}</td>
|
| 103 |
-
<td>{number_of_runs}</td>
|
| 104 |
-
<td>{last_updated}</td>
|
| 105 |
-
</tr>
|
| 106 |
-
</table>
|
| 107 |
-
</div>
|
| 108 |
-
"""
|
| 109 |
-
|
| 110 |
def highlight_score_column(s):
|
| 111 |
"""
|
| 112 |
Highlight the 'Score' column with a custom background color.
|
|
|
|
| 5 |
from datetime import datetime
|
| 6 |
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def fetch_competition_summary(api, projects, selected_project):
|
| 9 |
data = []
|
| 10 |
|
|
|
|
| 73 |
|
| 74 |
return df
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
def highlight_score_column(s):
|
| 77 |
"""
|
| 78 |
Highlight the 'Score' column with a custom background color.
|