Pendrokar commited on
Commit
bbfb485
1 Parent(s): ee7a278

Merge branch 'pr/44' into main_sample_44

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -1060,9 +1060,9 @@ def synthandreturn(text):
1060
  gr.update(visible=False), #prevmodel1
1061
  gr.update(visible=False), #prevmodel2
1062
  gr.update(visible=False), #nxt round btn
1063
- # reset aplayed, bplayed audio playback events
1064
- gr.update(value=False), #aplayed
1065
- gr.update(value=False), #bplayed
1066
  )
1067
  # return (
1068
  # text,
@@ -1092,17 +1092,18 @@ def synthandreturn(text):
1092
  def unlock_vote(btn_index, aplayed, bplayed):
1093
  # sample played
1094
  if btn_index == 0:
1095
- aplayed = gr.State(value=True)
1096
  if btn_index == 1:
1097
- bplayed = gr.State(value=True)
1098
 
1099
  # both audio samples played
1100
  if bool(aplayed) and bool(bplayed):
1101
  print('Both audio samples played, voting unlocked')
1102
- return [gr.update(interactive=True), gr.update(interactive=True), gr.update(), gr.update()]
1103
 
1104
  return [gr.update(), gr.update(), aplayed, bplayed]
1105
 
 
1106
  def cachedsent(request: gr.Request):
1107
  # add new userid to voting_users from Browser session hash
1108
  # stored only in RAM
@@ -1159,21 +1160,22 @@ def randomsent():
1159
  return '⚡', random.choice(sents), '🎲'
1160
  def clear_stuff():
1161
  return [
1162
- '',
1163
  "Synthesize",
1164
- gr.update(visible=True), # r2
1165
  '', # model1
1166
  '', # model2
1167
  gr.update(visible=False), # aud1
1168
  gr.update(visible=False), # aud2
1169
- gr.update(visible=False), #abetter
1170
- gr.update(visible=False), #bbetter
1171
  gr.update(visible=False), #prevmodel1
1172
  gr.update(visible=False), #prevmodel2
1173
  gr.update(visible=False), #nxt round btn
1174
- gr.update(value=False), #aplayed
1175
- gr.update(value=False), #bplayed
1176
  ]
 
1177
  def disable():
1178
  return [gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False)]
1179
  def enable():
 
1060
  gr.update(visible=False), #prevmodel1
1061
  gr.update(visible=False), #prevmodel2
1062
  gr.update(visible=False), #nxt round btn
1063
+ # reset gr.State aplayed & bplayed
1064
+ False, #aplayed
1065
+ False, #bplayed
1066
  )
1067
  # return (
1068
  # text,
 
1092
  def unlock_vote(btn_index, aplayed, bplayed):
1093
  # sample played
1094
  if btn_index == 0:
1095
+ aplayed = True
1096
  if btn_index == 1:
1097
+ bplayed = True
1098
 
1099
  # both audio samples played
1100
  if bool(aplayed) and bool(bplayed):
1101
  print('Both audio samples played, voting unlocked')
1102
+ return [gr.update(interactive=True), gr.update(interactive=True), True, True]
1103
 
1104
  return [gr.update(), gr.update(), aplayed, bplayed]
1105
 
1106
+
1107
  def cachedsent(request: gr.Request):
1108
  # add new userid to voting_users from Browser session hash
1109
  # stored only in RAM
 
1160
  return '⚡', random.choice(sents), '🎲'
1161
  def clear_stuff():
1162
  return [
1163
+ "",
1164
  "Synthesize",
1165
+ gr.update(visible=False), # r2
1166
  '', # model1
1167
  '', # model2
1168
  gr.update(visible=False), # aud1
1169
  gr.update(visible=False), # aud2
1170
+ gr.update(visible=False, interactive=False), #abetter
1171
+ gr.update(visible=False, interactive=False), #bbetter
1172
  gr.update(visible=False), #prevmodel1
1173
  gr.update(visible=False), #prevmodel2
1174
  gr.update(visible=False), #nxt round btn
1175
+ False, #aplayed
1176
+ False, #bplayed
1177
  ]
1178
+
1179
  def disable():
1180
  return [gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False)]
1181
  def enable():