elibrowne commited on
Commit
0d8264c
1 Parent(s): 85f3be6

New toggle mechanism?

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -99,7 +99,7 @@ with gr.Blocks(theme = theme) as user_eval:
99
  selection = gr.HTML("""
100
  <h2> Retrieved Passage </h2>
101
  <p> """ + passage_texts[0] + "</p>")
102
- forward_btn = gr.Button("Next question", visible = False)
103
  line = gr.Markdown("---")
104
  # New answers is able to render the Q and A with formatting. It doesn't change the contents of the answers.
105
  new_answers = answers_text.copy()
@@ -190,12 +190,12 @@ with gr.Blocks(theme = theme) as user_eval:
190
  else:
191
  return {
192
  selection: gr.Markdown("Click the button to advance to the next question."),
193
- forward_btn: gr.Button(visible = True)
194
  }
195
  else:
196
  return {
197
  selection: gr.Markdown("Click the button to advance to the next question."),
198
- forward_btn: gr.Button(visible = True)
199
  }
200
 
201
  btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
@@ -230,16 +230,17 @@ with gr.Blocks(theme = theme) as user_eval:
230
  scores_p: gr.Column(visible = True),
231
  scores_g: gr.Column(visible = False),
232
  evals: gr.Row(visible = False),
233
- question: gr.Row(visible = True)
 
234
  }
235
 
236
- forward_btn.click(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question])
237
 
238
  with gr.Row() as login:
239
  with gr.Column():
240
  gr.Markdown("---")
241
  gr.Markdown("# Enter email to start")
242
- gr.Markdown("Thank you so much for your participation in our study! Please enter your email — we're using it to keep track of which questions you've answered and which you haven't seen. Use the same email every time to keep your progress saved. :)")
243
  email = gr.Textbox(label = "Email", placeholder = "[email protected]")
244
  s = gr.Button("Start!")
245
 
 
99
  selection = gr.HTML("""
100
  <h2> Retrieved Passage </h2>
101
  <p> """ + passage_texts[0] + "</p>")
102
+ forward_btn = gr.HTML("1", visible = False, elem_id = "togglebutton")
103
  line = gr.Markdown("---")
104
  # New answers is able to render the Q and A with formatting. It doesn't change the contents of the answers.
105
  new_answers = answers_text.copy()
 
190
  else:
191
  return {
192
  selection: gr.Markdown("Click the button to advance to the next question."),
193
+ forward_btn: gr.HTML("changed")
194
  }
195
  else:
196
  return {
197
  selection: gr.Markdown("Click the button to advance to the next question."),
198
+ forward_btn: gr.HTML("changed")
199
  }
200
 
201
  btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
 
230
  scores_p: gr.Column(visible = True),
231
  scores_g: gr.Column(visible = False),
232
  evals: gr.Row(visible = False),
233
+ question: gr.Row(visible = True),
234
+ forward_btn: gr.HTML("unchanged")
235
  }
236
 
237
+ forward_btn.change(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question, forward_btn])
238
 
239
  with gr.Row() as login:
240
  with gr.Column():
241
  gr.Markdown("---")
242
  gr.Markdown("# Enter email to start")
243
+ gr.Markdown("Thank you so much for your participation in our study! We're using emails to keep track of which questions you've answered and which you haven't seen. Use the same email every time to keep your progress saved. :)")
244
  email = gr.Textbox(label = "Email", placeholder = "[email protected]")
245
  s = gr.Button("Start!")
246