Spaces:
Running
Running
moved unlock_vote to vote.py
Browse files- app/vote.py +18 -1
app/vote.py
CHANGED
|
@@ -111,4 +111,21 @@ def reload(chosenmodel1=None, chosenmodel2=None, userid=None, chose_a=False, cho
|
|
| 111 |
out.append(gr.update(value=f'{chosenmodel1}', interactive=False, visible=True))
|
| 112 |
out.append(gr.update(value=f'Your vote: {chosenmodel2}', interactive=False, visible=True))
|
| 113 |
out.append(gr.update(visible=True))
|
| 114 |
-
return out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
out.append(gr.update(value=f'{chosenmodel1}', interactive=False, visible=True))
|
| 112 |
out.append(gr.update(value=f'Your vote: {chosenmodel2}', interactive=False, visible=True))
|
| 113 |
out.append(gr.update(visible=True))
|
| 114 |
+
return out
|
| 115 |
+
|
| 116 |
+
def unlock_vote(autoplay, btn_index, aplayed, bplayed):
|
| 117 |
+
if autoplay == False:
|
| 118 |
+
return [gr.update(), gr.update(), aplayed, bplayed]
|
| 119 |
+
|
| 120 |
+
# sample played
|
| 121 |
+
if btn_index == 0:
|
| 122 |
+
aplayed = True
|
| 123 |
+
if btn_index == 1:
|
| 124 |
+
bplayed = True
|
| 125 |
+
|
| 126 |
+
# both audio samples played
|
| 127 |
+
if bool(aplayed) and bool(bplayed):
|
| 128 |
+
# print('Both audio samples played, voting unlocked')
|
| 129 |
+
return [gr.update(interactive=True), gr.update(interactive=True), True, True]
|
| 130 |
+
|
| 131 |
+
return [gr.update(), gr.update(), aplayed, bplayed]
|