mrfakename commited on
Commit
5404187
1 Parent(s): 3ef2ca7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -19
app.py CHANGED
@@ -339,24 +339,25 @@ def both_good(model1, model2, userid):
339
  return reload(model1, model2, userid)
340
  def reload(chosenmodel1=None, chosenmodel2=None, userid=None):
341
  # Select random splits
342
- row = random.choice(list(audio_dataset['train']))
343
- options = list(random.choice(list(audio_dataset['train'])).keys())
344
- split1, split2 = random.sample(options, 2)
345
- choice1, choice2 = (row[split1], row[split2])
346
- if chosenmodel1 in model_names:
347
- chosenmodel1 = model_names[chosenmodel1]
348
- if chosenmodel2 in model_names:
349
- chosenmodel2 = model_names[chosenmodel2]
350
- out = [
351
- (choice1['sampling_rate'], choice1['array']),
352
- (choice2['sampling_rate'], choice2['array']),
353
- split1,
354
- split2
355
- ]
356
- if userid: out.append(userid)
357
- if chosenmodel1: out.append(f'This model was {chosenmodel1}')
358
- if chosenmodel2: out.append(f'This model was {chosenmodel2}')
359
- return out
 
360
 
361
  with gr.Blocks() as leaderboard:
362
  gr.Markdown(LDESC)
@@ -462,7 +463,7 @@ with gr.Blocks() as vote:
462
  outputs = [text, btn, r1, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2]
463
  btn.click(synthandreturn, inputs=[text], outputs=outputs)
464
 
465
- nxt_outputs = [aud1, aud2, model1, model2, useridstate, prevmodel1, prevmodel2]
466
  abetter.click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
467
  bbetter.click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
468
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
 
339
  return reload(model1, model2, userid)
340
  def reload(chosenmodel1=None, chosenmodel2=None, userid=None):
341
  # Select random splits
342
+ # row = random.choice(list(audio_dataset['train']))
343
+ # options = list(random.choice(list(audio_dataset['train'])).keys())
344
+ # split1, split2 = random.sample(options, 2)
345
+ # choice1, choice2 = (row[split1], row[split2])
346
+ # if chosenmodel1 in model_names:
347
+ # chosenmodel1 = model_names[chosenmodel1]
348
+ # if chosenmodel2 in model_names:
349
+ # chosenmodel2 = model_names[chosenmodel2]
350
+ # out = [
351
+ # (choice1['sampling_rate'], choice1['array']),
352
+ # (choice2['sampling_rate'], choice2['array']),
353
+ # split1,
354
+ # split2
355
+ # ]
356
+ # if userid: out.append(userid)
357
+ # if chosenmodel1: out.append(f'This model was {chosenmodel1}')
358
+ # if chosenmodel2: out.append(f'This model was {chosenmodel2}')
359
+ # return out
360
+ return (f'This model was {chosenmodel1}', f'This model was {chosenmodel2}')
361
 
362
  with gr.Blocks() as leaderboard:
363
  gr.Markdown(LDESC)
 
463
  outputs = [text, btn, r1, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2]
464
  btn.click(synthandreturn, inputs=[text], outputs=outputs)
465
 
466
+ nxt_outputs = [prevmodel1, prevmodel2]
467
  abetter.click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
468
  bbetter.click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
469
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])