Pendrokar commited on
Commit
ac553fe
·
1 Parent(s): 5cdb38c

bolden top_five

Browse files
Files changed (3) hide show
  1. app/leaderboard.py +0 -1
  2. app/models.py +27 -0
  3. app/synth.py +0 -18
app/leaderboard.py CHANGED
@@ -1,7 +1,6 @@
1
  from .config import *
2
  from .db import *
3
  from .models import *
4
- from .synth import top_five
5
 
6
  import pandas as pd
7
 
 
1
  from .config import *
2
  from .db import *
3
  from .models import *
 
4
 
5
  import pandas as pd
6
 
app/models.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  from gradio_client import handle_file
 
3
 
4
  # Models to enable, only include models that users can vote on
5
  AVAILABLE_MODELS = {
@@ -715,6 +716,25 @@ closed_source = [
715
  'PlayDialog',
716
  ]
717
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718
  def make_link_to_space(model_name, for_leaderboard=False):
719
  # create a anchor link if a HF space
720
  style = 'text-decoration: underline;text-decoration-style: dotted;'
@@ -728,6 +748,13 @@ def make_link_to_space(model_name, for_leaderboard=False):
728
  style += 'font-style: italic;'
729
  title += model_name +'; Disabled (See AVAILABLE_MODELS within code for why)'
730
 
 
 
 
 
 
 
 
731
  model_basename = model_name
732
  if model_name in HF_SPACES:
733
  model_basename = HF_SPACES[model_name]['name']
 
1
  import os
2
  from gradio_client import handle_file
3
+ from .db import *
4
 
5
  # Models to enable, only include models that users can vote on
6
  AVAILABLE_MODELS = {
 
716
  'PlayDialog',
717
  ]
718
 
719
+ # top five models in order to always have one of them picked and scrutinized
720
+ top_five = []
721
+
722
+ # prioritize low vote models
723
+ sql = 'SELECT name FROM model WHERE (upvote + downvote) < 750 ORDER BY (upvote + downvote) ASC'
724
+ conn = get_db()
725
+ cursor = conn.cursor()
726
+ cursor.execute(sql)
727
+ data = cursor.fetchall()
728
+ for model in data:
729
+ if (
730
+ len(top_five) >= 5
731
+ ):
732
+ break
733
+
734
+ if model[0] in AVAILABLE_MODELS.keys():
735
+ top_five.append(model[0])
736
+ print(f"low vote top_five: {top_five}")
737
+
738
  def make_link_to_space(model_name, for_leaderboard=False):
739
  # create a anchor link if a HF space
740
  style = 'text-decoration: underline;text-decoration-style: dotted;'
 
748
  style += 'font-style: italic;'
749
  title += model_name +'; Disabled (See AVAILABLE_MODELS within code for why)'
750
 
751
+ # bolden top five models which get more scrutinized
752
+ print(top_five)
753
+ if model_name in top_five:
754
+ print('Warning: top_five is not set')
755
+ style += 'font-weight: bold;'
756
+ title += '; scrutinized'
757
+
758
  model_basename = model_name
759
  if model_name in HF_SPACES:
760
  model_basename = HF_SPACES[model_name]['name']
app/synth.py CHANGED
@@ -11,26 +11,8 @@ import random, os, threading, tempfile
11
  from langdetect import detect
12
  from .vote import log_text
13
 
14
- # top five models in order to always have one of them picked and scrutinized
15
- top_five = []
16
  hf_token=os.getenv('HF_TOKEN')
17
 
18
- # prioritize low vote models
19
- sql = 'SELECT name FROM model WHERE (upvote + downvote) < 750 ORDER BY (upvote + downvote) ASC'
20
- conn = get_db()
21
- cursor = conn.cursor()
22
- cursor.execute(sql)
23
- data = cursor.fetchall()
24
- for model in data:
25
- if (
26
- len(top_five) >= 5
27
- ):
28
- break
29
-
30
- if model[0] in AVAILABLE_MODELS.keys():
31
- top_five.append(model[0])
32
- print(f"low vote top_five: {top_five}")
33
-
34
  def random_m():
35
  return random.sample(list(set(AVAILABLE_MODELS.keys())), 2)
36
 
 
11
  from langdetect import detect
12
  from .vote import log_text
13
 
 
 
14
  hf_token=os.getenv('HF_TOKEN')
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  def random_m():
17
  return random.sample(list(set(AVAILABLE_MODELS.keys())), 2)
18