main-horse commited on
Commit
355d6f9
1 Parent(s): 353a56a

improve leaderboard

Browse files

1. lb description
2. reveal prelim results
3. all models gated by single vote cap

Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -77,10 +77,12 @@ def create_db_if_missing():
77
  def get_db():
78
  return sqlite3.connect(DB_PATH)
79
 
80
- def get_leaderboard():
81
  conn = get_db()
82
  cursor = conn.cursor()
83
- cursor.execute('SELECT name, upvote, downvote FROM model WHERE (upvote + downvote) > 750')
 
 
84
  data = cursor.fetchall()
85
  df = pd.DataFrame(data, columns=['name', 'upvote', 'downvote'])
86
  df['license'] = df['name'].map(model_licenses).fillna("Unknown")
@@ -205,7 +207,11 @@ Please assume all generated audio clips are not licensed to be redistributed and
205
  LDESC = """
206
  ## Leaderboard
207
 
208
- A list of the models, based on how highly they are ranked! **If there are no results, please check back in a couple days for more votes to be submitted.**
 
 
 
 
209
  """.strip()
210
 
211
 
@@ -407,9 +413,12 @@ with gr.Blocks() as leaderboard:
407
  gr.Markdown(LDESC)
408
  # df = gr.Dataframe(interactive=False, value=get_leaderboard())
409
  df = gr.Dataframe(interactive=False, min_width=0, wrap=True, column_widths=[30, 200, 50, 75, 50])
410
- reloadbtn = gr.Button("Refresh")
411
- leaderboard.load(get_leaderboard, outputs=[df])
412
- reloadbtn.click(get_leaderboard, outputs=[df])
 
 
 
413
  gr.Markdown("DISCLAIMER: The licenses listed may not be accurate or up to date, you are responsible for checking the licenses before using the models. Also note that some models may have additional usage restrictions.")
414
 
415
  # with gr.Blocks() as vote:
 
77
  def get_db():
78
  return sqlite3.connect(DB_PATH)
79
 
80
+ def get_leaderboard(reveal_prelim: bool):
81
  conn = get_db()
82
  cursor = conn.cursor()
83
+ sql = 'SELECT name, upvote, downvote FROM model'
84
+ if not reveal_prelim: sql += 'WHERE EXISTS (SELECT 1 FROM model WHERE (upvote + downvote) > 750)'
85
+ cursor.execute(sql)
86
  data = cursor.fetchall()
87
  df = pd.DataFrame(data, columns=['name', 'upvote', 'downvote'])
88
  df['license'] = df['name'].map(model_licenses).fillna("Unknown")
 
207
  LDESC = """
208
  ## Leaderboard
209
 
210
+ A list of the models, based on how highly they are ranked!
211
+
212
+ ### **Important**: To keep a fair impression of results, the leaderboard will be **hidden** by default, until a large number of human ratings have been recorded.
213
+
214
+ Tick the `Reveal Preliminary Results` checkbox below if you wish to see the raw data.
215
  """.strip()
216
 
217
 
 
413
  gr.Markdown(LDESC)
414
  # df = gr.Dataframe(interactive=False, value=get_leaderboard())
415
  df = gr.Dataframe(interactive=False, min_width=0, wrap=True, column_widths=[30, 200, 50, 75, 50])
416
+ with gr.Row():
417
+ reveal_prelim = gr.Checkbox(label="Reveal Preliminary Results", info="Show all models, including models with very few human ratings.", scale=0)
418
+ reloadbtn = gr.Button("Refresh")
419
+ reveal_prelim.input(get_leaderboard, inputs=[reveal_prelim], outputs=[df])
420
+ leaderboard.load(get_leaderboard, inputs=[reveal_prelim], outputs=[df])
421
+ reloadbtn.click(get_leaderboard, inputs=[reveal_prelim], outputs=[df])
422
  gr.Markdown("DISCLAIMER: The licenses listed may not be accurate or up to date, you are responsible for checking the licenses before using the models. Also note that some models may have additional usage restrictions.")
423
 
424
  # with gr.Blocks() as vote: