Spaces:
Running
on
Zero
Running
on
Zero
prelim > 300; medals
Browse files
app.py
CHANGED
@@ -631,7 +631,7 @@ def get_leaderboard(reveal_prelim = False):
|
|
631 |
cursor = conn.cursor()
|
632 |
sql = 'SELECT name, upvote, downvote FROM model'
|
633 |
# if not reveal_prelim: sql += ' WHERE EXISTS (SELECT 1 FROM model WHERE (upvote + downvote) > 750)'
|
634 |
-
if not reveal_prelim: sql += ' WHERE (upvote + downvote) >
|
635 |
cursor.execute(sql)
|
636 |
data = cursor.fetchall()
|
637 |
df = pd.DataFrame(data, columns=['name', 'upvote', 'downvote'])
|
@@ -656,9 +656,20 @@ def get_leaderboard(reveal_prelim = False):
|
|
656 |
df['score'] = round(df['score'])
|
657 |
## ELO SCORE
|
658 |
df = df.sort_values(by='score', ascending=False)
|
659 |
-
|
660 |
-
|
661 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
df = df[['order', 'name', 'score', 'votes']]
|
663 |
return df
|
664 |
|
|
|
631 |
cursor = conn.cursor()
|
632 |
sql = 'SELECT name, upvote, downvote FROM model'
|
633 |
# if not reveal_prelim: sql += ' WHERE EXISTS (SELECT 1 FROM model WHERE (upvote + downvote) > 750)'
|
634 |
+
if not reveal_prelim: sql += ' WHERE (upvote + downvote) > 300'
|
635 |
cursor.execute(sql)
|
636 |
data = cursor.fetchall()
|
637 |
df = pd.DataFrame(data, columns=['name', 'upvote', 'downvote'])
|
|
|
656 |
df['score'] = round(df['score'])
|
657 |
## ELO SCORE
|
658 |
df = df.sort_values(by='score', ascending=False)
|
659 |
+
# medals
|
660 |
+
def assign_medal(rank, assign):
|
661 |
+
rank = str(rank + 1)
|
662 |
+
if assign:
|
663 |
+
if rank == '1':
|
664 |
+
rank += '🥇'
|
665 |
+
elif rank == '2':
|
666 |
+
rank += '🥈'
|
667 |
+
elif rank == '3':
|
668 |
+
rank += '🥉'
|
669 |
+
|
670 |
+
return '#'+ rank
|
671 |
+
|
672 |
+
df['order'] = [assign_medal(i, not reveal_prelim and len(df) > 2) for i in range(len(df))]
|
673 |
df = df[['order', 'name', 'score', 'votes']]
|
674 |
return df
|
675 |
|