elibrowne commited on
Commit
7493d62
·
1 Parent(s): 7f0d971

Toggle out of scope probably...

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -114,6 +114,7 @@ with gr.Blocks(theme = theme) as user_eval:
114
  + """ + new_answers[2] +
115
  """ \n
116
  + """ + new_answers[3])
 
117
 
118
  # Scoring box
119
  with gr.Column(scale = 1) as scores_p:
@@ -173,27 +174,31 @@ with gr.Blocks(theme = theme) as user_eval:
173
  if step > 11 and not sample_dict["top10_contains_gold_passage"]:
174
  if step == 12:
175
  return {
176
- selection: gr.HTML("""
177
- <h2> Retrieved Passage </h2> <br />
178
- """ + gold_passage)
 
179
  }
180
  elif step == 13:
181
  return {
182
- selection: gr.HTML("""
183
- <h2> Autogenerated Response </h2> <br />
184
- """ + gold_passage_generation)
 
185
  }
186
  else:
187
  return {
188
- selection: gr.Button("Next question").click(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question])
 
189
  }
190
  else:
191
  return {
192
- selection: gr.Button("Next question").click(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question])
 
193
  }
194
 
195
  btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
196
- btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied], outputs = [selection])
197
 
198
  # Question and answering dynamics
199
  with gr.Row(equal_height = False, visible = False) as question:
@@ -227,6 +232,8 @@ with gr.Blocks(theme = theme) as user_eval:
227
  question: gr.Row(visible = True)
228
  }
229
 
 
 
230
  with gr.Row() as login:
231
  with gr.Column():
232
  gr.Markdown("---")
 
114
  + """ + new_answers[2] +
115
  """ \n
116
  + """ + new_answers[3])
117
+ forward_btn = gr.Button("Next question", visible = False)
118
 
119
  # Scoring box
120
  with gr.Column(scale = 1) as scores_p:
 
174
  if step > 11 and not sample_dict["top10_contains_gold_passage"]:
175
  if step == 12:
176
  return {
177
+ selection: gr.HTML("""
178
+ <h2> Retrieved Passage </h2> <br />
179
+ """ + gold_passage),
180
+ forward_btn: gr.Button()
181
  }
182
  elif step == 13:
183
  return {
184
+ selection: gr.HTML("""
185
+ <h2> Autogenerated Response </h2> <br />
186
+ """ + gold_passage_generation),
187
+ forward_btn: gr.Button()
188
  }
189
  else:
190
  return {
191
+ selection: gr.Markdown("Click the button to advance to the next question."),
192
+ forward_btn: gr.Button(visible = True)
193
  }
194
  else:
195
  return {
196
+ selection: gr.Markdown("Click the button to advance to the next question."),
197
+ forward_btn: gr.Button(visible = True)
198
  }
199
 
200
  btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
201
+ btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied], outputs = [selection, forward_btn])
202
 
203
  # Question and answering dynamics
204
  with gr.Row(equal_height = False, visible = False) as question:
 
232
  question: gr.Row(visible = True)
233
  }
234
 
235
+ forward_btn.click(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question])
236
+
237
  with gr.Row() as login:
238
  with gr.Column():
239
  gr.Markdown("---")