bulubula commited on
Commit
94ecc69
1 Parent(s): 98646bf
Files changed (2) hide show
  1. app.py +8 -19
  2. utils.py +18 -0
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, highlight_score_column
8
  # from dotenv import load_dotenv
9
  from cfg import *
10
  # load_dotenv()
@@ -108,29 +108,18 @@ def main():
108
 
109
 
110
  st.subheader("Summary information")
111
- st.markdown(f"""
112
- <div class="table-container">
113
- <table class="summary-table">
114
- <tr>
115
- <th>Number of competitions</th>
116
- <th>Number of models run</th>
117
- <th>Last updated</th>
118
- </tr>
119
- <tr>
120
- <td>{number_of_competitions}</td>
121
- <td>{number_of_runs}</td>
122
- <td>{last_updated}</td>
123
- </tr>
124
- </table>
125
- </div>
126
- """, unsafe_allow_html=True)
127
 
128
  st.subheader("###")
129
  st.markdown("<h2 style='text-align: center; font-size: 28px;'>Competitions</h2>", unsafe_allow_html=True)
130
  st.write("#### Select a competition to view more details and rankings.")
131
 
132
  # Create a header for the table
133
- cols = st.columns([1, 3, 2, 2, 2, 2])
134
  headers = ["Index", "Competition Name", "Date", "Miner hotkey", "Days on Top"]
135
  for col, header in zip(cols, headers):
136
  col.write(header)
@@ -139,7 +128,7 @@ def main():
139
  for index, (competition, details) in enumerate(COMPETITIONS.items(), start=1):
140
  leader_info = st.session_state.get("leader_info", {}).get(competition, {})
141
 
142
- cols = st.columns([1, 3, 2, 2, 2, 2])
143
  cols[0].write(index)
144
 
145
  if cols[1].button(competition):
 
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, competition_summary_table
8
  # from dotenv import load_dotenv
9
  from cfg import *
10
  # load_dotenv()
 
108
 
109
 
110
  st.subheader("Summary information")
111
+ table_html = competition_summary_table(number_of_competitions, number_of_runs, last_updated)
112
+
113
+ # Render the table using st.markdown
114
+ st.markdown(table_html, unsafe_allow_html=True)
115
+
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  st.subheader("###")
118
  st.markdown("<h2 style='text-align: center; font-size: 28px;'>Competitions</h2>", unsafe_allow_html=True)
119
  st.write("#### Select a competition to view more details and rankings.")
120
 
121
  # Create a header for the table
122
+ cols = st.columns([1, 3, 2, 2, 3, 1])
123
  headers = ["Index", "Competition Name", "Date", "Miner hotkey", "Days on Top"]
124
  for col, header in zip(cols, headers):
125
  col.write(header)
 
128
  for index, (competition, details) in enumerate(COMPETITIONS.items(), start=1):
129
  leader_info = st.session_state.get("leader_info", {}).get(competition, {})
130
 
131
+ cols = st.columns([1, 3, 2, 2, 3, 1])
132
  cols[0].write(index)
133
 
134
  if cols[1].button(competition):
utils.py CHANGED
@@ -89,6 +89,24 @@ def fetch_models_evaluation(api, projects, selected_project):
89
 
90
  return df
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  def highlight_score_column(s):
93
  """
94
  Highlight the 'Score' column with a custom background color.
 
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.