Spaces:
Running
Running
win rate
Browse files- app/leaderboard.py +19 -16
- app/models.py +31 -0
- app/ui_leaderboard.py +2 -2
app/leaderboard.py
CHANGED
|
@@ -21,27 +21,30 @@ def get_leaderboard(reveal_prelim = False):
|
|
| 21 |
df['name'] = df['name'].replace(model_names)
|
| 22 |
for i in range(len(df)):
|
| 23 |
df.loc[i, "name"] = make_link_to_space(df['name'][i], True)
|
|
|
|
|
|
|
| 24 |
df['votes'] = df['upvote'] + df['downvote']
|
|
|
|
| 25 |
# df['score'] = round((df['upvote'] / df['votes']) * 100, 2) # Percentage score
|
| 26 |
|
| 27 |
## ELO SCORE
|
| 28 |
-
df['
|
| 29 |
-
df['
|
| 30 |
for i in range(len(df)):
|
| 31 |
for j in range(len(df)):
|
| 32 |
if i != j:
|
| 33 |
try:
|
| 34 |
-
expected_a = 1 / (1 + 10 ** ((df['
|
| 35 |
-
expected_b = 1 / (1 + 10 ** ((df['
|
| 36 |
actual_a = df['upvote'].iloc[i] / df['votes'].iloc[i] if df['votes'].iloc[i] > 0 else 0.5
|
| 37 |
actual_b = df['upvote'].iloc[j] / df['votes'].iloc[j] if df['votes'].iloc[j] > 0 else 0.5
|
| 38 |
-
df.at[i, '
|
| 39 |
-
df.at[j, '
|
| 40 |
except Exception as e:
|
| 41 |
print(f"Error in ELO calculation for rows {i} and {j}: {str(e)}")
|
| 42 |
continue
|
| 43 |
-
df['
|
| 44 |
-
df['
|
| 45 |
|
| 46 |
if (
|
| 47 |
reveal_prelim == False
|
|
@@ -51,18 +54,18 @@ def get_leaderboard(reveal_prelim = False):
|
|
| 51 |
|
| 52 |
if (reveal_prelim == False):
|
| 53 |
for i in range(len(df)):
|
| 54 |
-
|
| 55 |
-
if (
|
| 56 |
continue
|
| 57 |
-
if (
|
| 58 |
plus = '<em style="color: green; font-family: monospace">+'
|
| 59 |
else:
|
| 60 |
plus = '<em style="color: red; font-family: monospace">'
|
| 61 |
|
| 62 |
-
df.at[i, '
|
| 63 |
|
| 64 |
-
## ELO
|
| 65 |
-
df = df.sort_values(by='
|
| 66 |
# medals
|
| 67 |
def assign_medal(rank, assign):
|
| 68 |
rank = str(rank + 1)
|
|
@@ -86,6 +89,6 @@ def get_leaderboard(reveal_prelim = False):
|
|
| 86 |
):
|
| 87 |
top_five.append(orig_name)
|
| 88 |
|
| 89 |
-
df['
|
| 90 |
-
df = df[['order', 'name', '
|
| 91 |
return df
|
|
|
|
| 21 |
df['name'] = df['name'].replace(model_names)
|
| 22 |
for i in range(len(df)):
|
| 23 |
df.loc[i, "name"] = make_link_to_space(df['name'][i], True)
|
| 24 |
+
|
| 25 |
+
# Calculate total votes and win rate
|
| 26 |
df['votes'] = df['upvote'] + df['downvote']
|
| 27 |
+
df['win_rate'] = (df['upvote'] / df['votes'] * 100).round(1)
|
| 28 |
# df['score'] = round((df['upvote'] / df['votes']) * 100, 2) # Percentage score
|
| 29 |
|
| 30 |
## ELO SCORE
|
| 31 |
+
df['elo'] = 1200
|
| 32 |
+
df['elo_diff'] = ""
|
| 33 |
for i in range(len(df)):
|
| 34 |
for j in range(len(df)):
|
| 35 |
if i != j:
|
| 36 |
try:
|
| 37 |
+
expected_a = 1 / (1 + 10 ** ((df['elo'].iloc[j] - df['elo'].iloc[i]) / 400))
|
| 38 |
+
expected_b = 1 / (1 + 10 ** ((df['elo'].iloc[i] - df['elo'].iloc[j]) / 400))
|
| 39 |
actual_a = df['upvote'].iloc[i] / df['votes'].iloc[i] if df['votes'].iloc[i] > 0 else 0.5
|
| 40 |
actual_b = df['upvote'].iloc[j] / df['votes'].iloc[j] if df['votes'].iloc[j] > 0 else 0.5
|
| 41 |
+
df.at[i, 'elo'] += round(32 * (actual_a - expected_a))
|
| 42 |
+
df.at[j, 'elo'] += round(32 * (actual_b - expected_b))
|
| 43 |
except Exception as e:
|
| 44 |
print(f"Error in ELO calculation for rows {i} and {j}: {str(e)}")
|
| 45 |
continue
|
| 46 |
+
df['elo'] = round(df['elo'])
|
| 47 |
+
df['elo_diff'] = df['elo']
|
| 48 |
|
| 49 |
if (
|
| 50 |
reveal_prelim == False
|
|
|
|
| 54 |
|
| 55 |
if (reveal_prelim == False):
|
| 56 |
for i in range(len(df)):
|
| 57 |
+
elo_diff = (df['elo'].iloc[i] - leaderboard_df['elo'].iloc[i])
|
| 58 |
+
if (elo_diff == 0):
|
| 59 |
continue
|
| 60 |
+
if (elo_diff > 0):
|
| 61 |
plus = '<em style="color: green; font-family: monospace">+'
|
| 62 |
else:
|
| 63 |
plus = '<em style="color: red; font-family: monospace">'
|
| 64 |
|
| 65 |
+
df.at[i, 'elo_diff'] = str(df['elo'].iloc[i]) + plus + str(elo_diff) +'</em>'
|
| 66 |
|
| 67 |
+
## ELO score
|
| 68 |
+
df = df.sort_values(by='elo', ascending=False)
|
| 69 |
# medals
|
| 70 |
def assign_medal(rank, assign):
|
| 71 |
rank = str(rank + 1)
|
|
|
|
| 89 |
):
|
| 90 |
top_five.append(orig_name)
|
| 91 |
|
| 92 |
+
df['elo'] = df['elo_diff']
|
| 93 |
+
df = df[['order', 'name', 'elo', 'votes', 'win_rate']]
|
| 94 |
return df
|
app/models.py
CHANGED
|
@@ -499,6 +499,37 @@ model_names = {
|
|
| 499 |
'metavoice': 'MetaVoice-1B',
|
| 500 |
}
|
| 501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
def make_link_to_space(model_name, for_leaderboard=False):
|
| 503 |
# create a anchor link if a HF space
|
| 504 |
style = 'text-decoration: underline;text-decoration-style: dotted;'
|
|
|
|
| 499 |
'metavoice': 'MetaVoice-1B',
|
| 500 |
}
|
| 501 |
|
| 502 |
+
model_links = {
|
| 503 |
+
'ElevenLabs': 'https://elevenlabs.io/',
|
| 504 |
+
'Play.HT 2.0': 'https://play.ht/',
|
| 505 |
+
'Play.HT 3.0 Mini': 'https://play.ht/',
|
| 506 |
+
'XTTSv2': 'https://huggingface.co/coqui/XTTS-v2',
|
| 507 |
+
'MeloTTS': 'https://github.com/myshell-ai/MeloTTS',
|
| 508 |
+
'StyleTTS 2': 'https://github.com/yl4579/StyleTTS2',
|
| 509 |
+
'Parler TTS Large': 'https://github.com/huggingface/parler-tts',
|
| 510 |
+
'Parler TTS': 'https://github.com/huggingface/parler-tts',
|
| 511 |
+
'Fish Speech v1.5': 'https://github.com/fishaudio/fish-speech',
|
| 512 |
+
'Fish Speech v1.4': 'https://github.com/fishaudio/fish-speech',
|
| 513 |
+
'GPT-SoVITS': 'https://github.com/RVC-Boss/GPT-SoVITS',
|
| 514 |
+
'WhisperSpeech': 'https://github.com/WhisperSpeech/WhisperSpeech',
|
| 515 |
+
'VoiceCraft 2.0': 'https://github.com/jasonppy/VoiceCraft',
|
| 516 |
+
'PlayDialog': 'https://play.ht/',
|
| 517 |
+
'Kokoro v0.19': 'https://huggingface.co/hexgrad/Kokoro-82M',
|
| 518 |
+
'CosyVoice 2.0': 'https://github.com/FunAudioLLM/CosyVoice',
|
| 519 |
+
'MetaVoice': 'https://github.com/metavoiceio/metavoice-src',
|
| 520 |
+
'OpenVoice': 'https://github.com/myshell-ai/OpenVoice',
|
| 521 |
+
'OpenVoice V2': 'https://github.com/myshell-ai/OpenVoice',
|
| 522 |
+
'Pheme': 'https://github.com/PolyAI-LDN/pheme',
|
| 523 |
+
'Vokan TTS': 'https://huggingface.co/ShoukanLabs/Vokan',
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
closed_source = [
|
| 527 |
+
'ElevenLabs',
|
| 528 |
+
'Play.HT 2.0',
|
| 529 |
+
'Play.HT 3.0 Mini',
|
| 530 |
+
'PlayDialog',
|
| 531 |
+
]
|
| 532 |
+
|
| 533 |
def make_link_to_space(model_name, for_leaderboard=False):
|
| 534 |
# create a anchor link if a HF space
|
| 535 |
style = 'text-decoration: underline;text-decoration-style: dotted;'
|
app/ui_leaderboard.py
CHANGED
|
@@ -9,8 +9,8 @@ with gr.Blocks() as leaderboard:
|
|
| 9 |
interactive=False,
|
| 10 |
min_width=0,
|
| 11 |
wrap=False,
|
| 12 |
-
column_widths=[30, 200, 50, 50],
|
| 13 |
-
datatype=["str", "html", "html", "number"]
|
| 14 |
)
|
| 15 |
reloadbtn = gr.Button("Refresh")
|
| 16 |
with gr.Row():
|
|
|
|
| 9 |
interactive=False,
|
| 10 |
min_width=0,
|
| 11 |
wrap=False,
|
| 12 |
+
column_widths=[30, 200, 50, 50, 50],
|
| 13 |
+
datatype=["str", "html", "html", "html", "number"]
|
| 14 |
)
|
| 15 |
reloadbtn = gr.Button("Refresh")
|
| 16 |
with gr.Row():
|