Spaces:
Running
Running
mrfakename
commited on
Commit
•
10801ae
1
Parent(s):
20db367
Update app.py
Browse files
app.py
CHANGED
@@ -298,26 +298,26 @@ def a_is_better(model1, model2, userid):
|
|
298 |
if model1 and model2:
|
299 |
upvote_model(model1, str(userid))
|
300 |
downvote_model(model2, str(userid))
|
301 |
-
return reload(model1, model2
|
302 |
def b_is_better(model1, model2, userid):
|
303 |
userid = mkuuid(userid)
|
304 |
if model1 and model2:
|
305 |
upvote_model(model2, str(userid))
|
306 |
downvote_model(model1, str(userid))
|
307 |
-
return reload(model1, model2
|
308 |
def both_bad(model1, model2, userid):
|
309 |
userid = mkuuid(userid)
|
310 |
if model1 and model2:
|
311 |
downvote_model(model1, str(userid))
|
312 |
downvote_model(model2, str(userid))
|
313 |
-
return reload(model1, model2
|
314 |
def both_good(model1, model2, userid):
|
315 |
userid = mkuuid(userid)
|
316 |
if model1 and model2:
|
317 |
upvote_model(model1, str(userid))
|
318 |
upvote_model(model2, str(userid))
|
319 |
-
return reload(model1, model2
|
320 |
-
def reload(chosenmodel1
|
321 |
# Select random splits
|
322 |
row = random.choice(list(audio_dataset['train']))
|
323 |
options = list(random.choice(list(audio_dataset['train'])).keys())
|
@@ -335,7 +335,7 @@ def reload(chosenmodel1=None, chosenmodel2=None):
|
|
335 |
]
|
336 |
if chosenmodel1: out.append(f'This model was {chosenmodel1}')
|
337 |
if chosenmodel2: out.append(f'This model was {chosenmodel2}')
|
338 |
-
return out
|
339 |
|
340 |
with gr.Blocks() as leaderboard:
|
341 |
gr.Markdown(LDESC)
|
@@ -390,7 +390,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, outputs=[aud1, aud2, model1, model2])
|
394 |
with gr.Blocks() as about:
|
395 |
gr.Markdown(ABOUT)
|
396 |
with gr.Blocks() as admin:
|
|
|
298 |
if model1 and model2:
|
299 |
upvote_model(model1, str(userid))
|
300 |
downvote_model(model2, str(userid))
|
301 |
+
return reload(model1, model2, userid)
|
302 |
def b_is_better(model1, model2, userid):
|
303 |
userid = mkuuid(userid)
|
304 |
if model1 and model2:
|
305 |
upvote_model(model2, str(userid))
|
306 |
downvote_model(model1, str(userid))
|
307 |
+
return reload(model1, model2, userid)
|
308 |
def both_bad(model1, model2, userid):
|
309 |
userid = mkuuid(userid)
|
310 |
if model1 and model2:
|
311 |
downvote_model(model1, str(userid))
|
312 |
downvote_model(model2, str(userid))
|
313 |
+
return reload(model1, model2, userid)
|
314 |
def both_good(model1, model2, userid):
|
315 |
userid = mkuuid(userid)
|
316 |
if model1 and model2:
|
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())
|
|
|
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 |
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:
|