Pendrokar commited on
Commit
1bfddbd
1 Parent(s): eb5f8ed

always pick one of low vote models first

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -533,6 +533,22 @@ scheduler = CommitScheduler(
533
  # Load audio dataset
534
  # audio_dataset = load_dataset(AUDIO_DATASET_ID)
535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  ####################################
537
  # Router API
538
  ####################################
@@ -783,7 +799,11 @@ def get_leaderboard(reveal_prelim = False):
783
  df['order'] = [assign_medal(i, not reveal_prelim and len(df) > 2) for i in range(len(df))]
784
  # fetch top_five
785
  for orig_name in df['orig_name']:
786
- if reveal_prelim and len(top_five) < 5:
 
 
 
 
787
  top_five.append(orig_name)
788
 
789
  df = df[['order', 'name', 'score', 'votes']]
 
533
  # Load audio dataset
534
  # audio_dataset = load_dataset(AUDIO_DATASET_ID)
535
 
536
+
537
+ # prioritize low vote models
538
+ sql = 'SELECT name FROM model WHERE (upvote + downvote) < 750 ORDER BY (upvote + downvote) ASC'
539
+ conn = get_db()
540
+ cursor = conn.cursor()
541
+ cursor.execute(sql)
542
+ data = cursor.fetchall()
543
+ for model in data:
544
+ if (
545
+ len(top_five) >= 5
546
+ ):
547
+ break
548
+
549
+ if model[0] in AVAILABLE_MODELS.keys():
550
+ top_five.append(model[0])
551
+
552
  ####################################
553
  # Router API
554
  ####################################
 
799
  df['order'] = [assign_medal(i, not reveal_prelim and len(df) > 2) for i in range(len(df))]
800
  # fetch top_five
801
  for orig_name in df['orig_name']:
802
+ if (
803
+ reveal_prelim
804
+ and len(top_five) < 5
805
+ and orig_name in AVAILABLE_MODELS.keys()
806
+ ):
807
  top_five.append(orig_name)
808
 
809
  df = df[['order', 'name', 'score', 'votes']]