Spaces:
Running
Running
Commit
·
0fdbcb9
1
Parent(s):
aaef8e0
verbose metric
Browse files- app.py +45 -41
- content.py +4 -2
app.py
CHANGED
|
@@ -15,8 +15,8 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(level
|
|
| 15 |
|
| 16 |
lb_server = LeaderboardServer()
|
| 17 |
|
| 18 |
-
LEADERBOARD_TYPES = ['NOTSOFAR-
|
| 19 |
-
MAX_SUBMISSIONS_PER_24H =
|
| 20 |
|
| 21 |
|
| 22 |
with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css="footer {visibility: hidden}") as main):
|
|
@@ -29,23 +29,26 @@ with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css="footer {visibility
|
|
| 29 |
with gr.Row():
|
| 30 |
# Leaderboards Tab #
|
| 31 |
####################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
with gr.Tab('Leaderboards') as leaderboards_tab:
|
| 33 |
gr.Markdown(LEADERBOARD_TAB_TITLE_MARKDOWN)
|
| 34 |
with gr.Row():
|
| 35 |
-
def populate_leaderboard(leaderboard_type):
|
| 36 |
-
leaderboard_df = lb_server.get_leaderboard(submission_type=leaderboard_type)
|
| 37 |
-
if leaderboard_df.empty:
|
| 38 |
-
return pd.DataFrame(columns=['No submissions yet'])
|
| 39 |
-
return leaderboard_df
|
| 40 |
-
|
| 41 |
for idx, tab_name in enumerate(LEADERBOARD_TYPES):
|
| 42 |
-
|
| 43 |
-
leaderboard_table = gr.DataFrame(populate_leaderboard(tab_name)) if idx == 0 else gr.DataFrame(pd.DataFrame(columns=['No submissions yet']))
|
| 44 |
-
leaderboard_tab.select(fn=populate_leaderboard,
|
| 45 |
-
inputs=[gr.Text(tab_name, visible=False)],
|
| 46 |
-
outputs=[leaderboard_table])
|
| 47 |
-
leaderboard_table.change(fn=populate_leaderboard, inputs=[gr.Text(tab_name, visible=False)],
|
| 48 |
-
outputs=[leaderboard_table])
|
| 49 |
|
| 50 |
# Submission Tab #
|
| 51 |
##################
|
|
@@ -137,32 +140,33 @@ with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css="footer {visibility
|
|
| 137 |
outputs=[my_submissions_table])
|
| 138 |
my_submissions_token_tb = gr.Textbox(label='Token', type='password')
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
submission_count = lb_server.get_submission_count_last_24_hours(hf_token=hf_token)
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
| 167 |
|
| 168 |
main.launch()
|
|
|
|
| 15 |
|
| 16 |
lb_server = LeaderboardServer()
|
| 17 |
|
| 18 |
+
LEADERBOARD_TYPES = ['NOTSOFAR-MC', 'NOTSOFAR-SC', 'DASR-Constrained-LM', 'DASR-Unconstrained-LM']
|
| 19 |
+
MAX_SUBMISSIONS_PER_24H = os.environ['MAX_SUBMISSIONS_PER_24H']
|
| 20 |
|
| 21 |
|
| 22 |
with (gr.Blocks(theme=gr.themes.Soft(text_size=text_md), css="footer {visibility: hidden}") as main):
|
|
|
|
| 29 |
with gr.Row():
|
| 30 |
# Leaderboards Tab #
|
| 31 |
####################
|
| 32 |
+
def populate_leaderboard(leaderboard_type):
|
| 33 |
+
leaderboard_df = lb_server.get_leaderboard(submission_type=leaderboard_type)
|
| 34 |
+
if leaderboard_df.empty:
|
| 35 |
+
return pd.DataFrame(columns=['No submissions yet'])
|
| 36 |
+
return leaderboard_df
|
| 37 |
+
|
| 38 |
+
def create_leaderboard_tab(tab_name):
|
| 39 |
+
with gr.Tab(tab_name) as leaderboard_tab:
|
| 40 |
+
leaderboard_table = gr.DataFrame(populate_leaderboard(tab_name)) if idx == 0 \
|
| 41 |
+
else gr.DataFrame(pd.DataFrame(columns=['No submissions yet']))
|
| 42 |
+
leaderboard_tab.select(fn=populate_leaderboard, inputs=[gr.Text(tab_name, visible=False)],
|
| 43 |
+
outputs=[leaderboard_table])
|
| 44 |
+
leaderboard_table.change(fn=populate_leaderboard, inputs=[gr.Text(tab_name, visible=False)],
|
| 45 |
+
outputs=[leaderboard_table])
|
| 46 |
+
|
| 47 |
with gr.Tab('Leaderboards') as leaderboards_tab:
|
| 48 |
gr.Markdown(LEADERBOARD_TAB_TITLE_MARKDOWN)
|
| 49 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
for idx, tab_name in enumerate(LEADERBOARD_TYPES):
|
| 51 |
+
create_leaderboard_tab(tab_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Submission Tab #
|
| 54 |
##################
|
|
|
|
| 140 |
outputs=[my_submissions_table])
|
| 141 |
my_submissions_token_tb = gr.Textbox(label='Token', type='password')
|
| 142 |
|
| 143 |
+
def on_token_insert(hf_token, app_state):
|
| 144 |
+
gr.Info(f'Verifying token...')
|
| 145 |
+
|
| 146 |
+
submission_count = None
|
| 147 |
+
if hf_token:
|
| 148 |
submission_count = lb_server.get_submission_count_last_24_hours(hf_token=hf_token)
|
| 149 |
+
|
| 150 |
+
if submission_count is None:
|
| 151 |
+
# Invalid token
|
| 152 |
+
app_state['hf_token'] = None
|
| 153 |
+
submissions_24h_str = ''
|
| 154 |
+
team_submissions_df = pd.DataFrame(columns=['Invalid Token'])
|
| 155 |
+
gr.Warning('Invalid token')
|
| 156 |
+
|
| 157 |
+
else:
|
| 158 |
+
app_state['hf_token'] = hf_token
|
| 159 |
+
submissions_24h_str = f'{submission_count}/{MAX_SUBMISSIONS_PER_24H}'
|
| 160 |
+
team_submissions_df = lb_server.get_submissions_by_hf_token(hf_token=hf_token)
|
| 161 |
+
if team_submissions_df.empty:
|
| 162 |
+
team_submissions_df = pd.DataFrame(columns=['No submissions yet'])
|
| 163 |
+
gr.Info('Token verified!')
|
| 164 |
+
|
| 165 |
+
return app_state, team_submissions_df, submissions_24h_str
|
| 166 |
+
|
| 167 |
+
hf_token_tb.change(fn=on_token_insert, inputs=[hf_token_tb, app_state],
|
| 168 |
+
outputs=[app_state, my_submissions_table, submissions_24h_txt])
|
| 169 |
+
my_submissions_token_tb.change(fn=on_token_insert, inputs=[my_submissions_token_tb, app_state],
|
| 170 |
+
outputs=[app_state, my_submissions_table, submissions_24h_txt])
|
| 171 |
|
| 172 |
main.launch()
|
content.py
CHANGED
|
@@ -21,7 +21,7 @@ HEADER_MARKDOWN = """
|
|
| 21 |
|
| 22 |
Featured in both tasks, the NOTSOFAR recorded meeting dataset is leveraged as a common benchmark:
|
| 23 |
each geometry-agnostic MC system submitted to DASR tracks (constrained or not) will also be **automatically submitted**
|
| 24 |
-
to the known-geometry NOTSOFAR-MC track. These entries will be marked with "DASR" to denote their origin.
|
| 25 |
"""
|
| 26 |
|
| 27 |
|
|
@@ -40,12 +40,14 @@ SUBMISSION_TAB_TITLE_MARKDOWN = """
|
|
| 40 |
- *Submission track:* The track to submit results to
|
| 41 |
- *Token:* Your Hugging Face token
|
| 42 |
- *Description:* Short description of your submission (optional)
|
| 43 |
-
|
| 44 |
**Hugging Face tokens:** To create a token, go to your profile settings > Access Tokens > New Token.
|
| 45 |
Name the token and give it a write role, then copy the token and paste it in the field below.\n
|
| 46 |
**Team creation:** Upon the first submission, your team name is associated with your Hugging Face user account.
|
| 47 |
Any token generated by your account can be used. All team members should use this specific user's token for
|
| 48 |
future submissions.
|
|
|
|
|
|
|
| 49 |
|
| 50 |
New tokens can be created by the team member who initially linked the team to the token.
|
| 51 |
"""
|
|
|
|
| 21 |
|
| 22 |
Featured in both tasks, the NOTSOFAR recorded meeting dataset is leveraged as a common benchmark:
|
| 23 |
each geometry-agnostic MC system submitted to DASR tracks (constrained or not) will also be **automatically submitted**
|
| 24 |
+
to the known-geometry single-device NOTSOFAR-MC track. These entries will be marked with "DASR" to denote their origin.
|
| 25 |
"""
|
| 26 |
|
| 27 |
|
|
|
|
| 40 |
- *Submission track:* The track to submit results to
|
| 41 |
- *Token:* Your Hugging Face token
|
| 42 |
- *Description:* Short description of your submission (optional)
|
| 43 |
+
|
| 44 |
**Hugging Face tokens:** To create a token, go to your profile settings > Access Tokens > New Token.
|
| 45 |
Name the token and give it a write role, then copy the token and paste it in the field below.\n
|
| 46 |
**Team creation:** Upon the first submission, your team name is associated with your Hugging Face user account.
|
| 47 |
Any token generated by your account can be used. All team members should use this specific user's token for
|
| 48 |
future submissions.
|
| 49 |
+
**Submission limit:** 5 submissions per team every 24 hours. Each participant should only belong to one team.
|
| 50 |
+
Changing team names is allowed, but it is not intended to bypass the daily submission limit.
|
| 51 |
|
| 52 |
New tokens can be created by the team member who initially linked the team to the token.
|
| 53 |
"""
|