mrfakename commited on
Commit
c3c44ca
1 Parent(s): 10801ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -317,7 +317,7 @@ def both_good(model1, model2, userid):
317
  upvote_model(model1, str(userid))
318
  upvote_model(model2, str(userid))
319
  return reload(model1, model2, userid)
320
- def reload(chosenmodel1, chosenmodel2, userid):
321
  # Select random splits
322
  row = random.choice(list(audio_dataset['train']))
323
  options = list(random.choice(list(audio_dataset['train'])).keys())
@@ -333,9 +333,10 @@ def reload(chosenmodel1, chosenmodel2, userid):
333
  split1,
334
  split2
335
  ]
 
336
  if chosenmodel1: out.append(f'This model was {chosenmodel1}')
337
  if chosenmodel2: out.append(f'This model was {chosenmodel2}')
338
- return out, userid
339
 
340
  with gr.Blocks() as leaderboard:
341
  gr.Markdown(LDESC)
@@ -390,7 +391,7 @@ with gr.Blocks() as vote:
390
  bothbad.click(both_bad, outputs=outputs, inputs=[model1, model2, useridstate])
391
  bothgood.click(both_good, outputs=outputs, inputs=[model1, model2, useridstate])
392
 
393
- vote.load(reload, inputs=[None, None, useridstate], outputs=[aud1, aud2, model1, model2])
394
  with gr.Blocks() as about:
395
  gr.Markdown(ABOUT)
396
  with gr.Blocks() as admin:
 
317
  upvote_model(model1, str(userid))
318
  upvote_model(model2, str(userid))
319
  return reload(model1, model2, userid)
320
+ def reload(chosenmodel1=None, chosenmodel2=None, userid=None):
321
  # Select random splits
322
  row = random.choice(list(audio_dataset['train']))
323
  options = list(random.choice(list(audio_dataset['train'])).keys())
 
333
  split1,
334
  split2
335
  ]
336
+ if userid: out.append(userid)
337
  if chosenmodel1: out.append(f'This model was {chosenmodel1}')
338
  if chosenmodel2: out.append(f'This model was {chosenmodel2}')
339
+ return out
340
 
341
  with gr.Blocks() as leaderboard:
342
  gr.Markdown(LDESC)
 
391
  bothbad.click(both_bad, outputs=outputs, inputs=[model1, model2, useridstate])
392
  bothgood.click(both_good, outputs=outputs, inputs=[model1, model2, useridstate])
393
 
394
+ vote.load(reload, outputs=[aud1, aud2, model1, model2])
395
  with gr.Blocks() as about:
396
  gr.Markdown(ABOUT)
397
  with gr.Blocks() as admin: