elibrowne commited on
Commit
9b16238
·
1 Parent(s): 8fcc488

Reset inputs after score

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -121,16 +121,12 @@ with gr.Blocks(theme = theme) as user_eval:
121
  with gr.Column(scale = 1) as scores_p:
122
  desc_0 = gr.Markdown("Does the passage describe **a legal rule?**")
123
  eval_0 = gr.Radio(["Yes", "No"], label = "Legal Rule?")
124
- eval_0.submit(lambda x : gr.update(value = ''), [], [eval_0])
125
  desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
126
  eval_1 = gr.Slider(1, 5, step = 0.5, label = "Relevance")
127
- eval_1.submit(lambda x : gr.update(value = ''), [], [eval_1])
128
  desc_2 = gr.Markdown("How would you rate the passage's **quality** in terms of detail, clarity, and focus?")
129
  eval_2 = gr.Slider(1, 5, step = 0.5, label = "Quality")
130
- eval_2.submit(lambda x : gr.update(value = ''), [], [eval_2])
131
  desc_3 = gr.Markdown("How effectively does the passage **lead you to the correct answer?**")
132
  eval_3 = gr.Slider(1, 5, step = 0.5, label = "Helpfulness")
133
- eval_3.submit(lambda x : gr.update(value = ''), [], [eval_3])
134
  btn_p = gr.Button("Next")
135
 
136
  with gr.Column(scale = 1, visible = False) as scores_g:
@@ -156,13 +152,23 @@ with gr.Blocks(theme = theme) as user_eval:
156
  return {
157
  selection: gr.HTML(collapsible_string),
158
  scores_p: gr.Column(visible = False),
159
- scores_g: gr.Column(visible = True)
 
 
 
 
160
  }
161
  else:
162
  return {
163
  selection: gr.HTML("""
164
  <h2> Retrieved Passage </h2> <br />
165
- """ + passage_texts[step])
 
 
 
 
 
 
166
  }
167
 
168
  def next_g(eval_helps, eval_satisfied):
@@ -217,8 +223,7 @@ with gr.Blocks(theme = theme) as user_eval:
217
  selection: gr.Markdown("Advancing to the next question..."),
218
  forward_btn: gr.Textbox("changed")
219
  }
220
-
221
- btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g])
222
  btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied], outputs = [selection, forward_btn])
223
 
224
  # Question and answering dynamics
 
121
  with gr.Column(scale = 1) as scores_p:
122
  desc_0 = gr.Markdown("Does the passage describe **a legal rule?**")
123
  eval_0 = gr.Radio(["Yes", "No"], label = "Legal Rule?")
 
124
  desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
125
  eval_1 = gr.Slider(1, 5, step = 0.5, label = "Relevance")
 
126
  desc_2 = gr.Markdown("How would you rate the passage's **quality** in terms of detail, clarity, and focus?")
127
  eval_2 = gr.Slider(1, 5, step = 0.5, label = "Quality")
 
128
  desc_3 = gr.Markdown("How effectively does the passage **lead you to the correct answer?**")
129
  eval_3 = gr.Slider(1, 5, step = 0.5, label = "Helpfulness")
 
130
  btn_p = gr.Button("Next")
131
 
132
  with gr.Column(scale = 1, visible = False) as scores_g:
 
152
  return {
153
  selection: gr.HTML(collapsible_string),
154
  scores_p: gr.Column(visible = False),
155
+ scores_g: gr.Column(visible = True),
156
+ eval_0: gr.Radio(value = None),
157
+ eval_1: gr.Slider(value = 1),
158
+ eval_2: gr.Slider(value = 1),
159
+ eval_3: gr.Slider(value = 1),
160
  }
161
  else:
162
  return {
163
  selection: gr.HTML("""
164
  <h2> Retrieved Passage </h2> <br />
165
+ """ + passage_texts[step]),
166
+ scores_p: gr.Column(), # no change
167
+ scores_g: gr.Column(), # no change
168
+ eval_0: gr.Radio(value = None),
169
+ eval_1: gr.Slider(value = 1),
170
+ eval_2: gr.Slider(value = 1),
171
+ eval_3: gr.Slider(value = 1),
172
  }
173
 
174
  def next_g(eval_helps, eval_satisfied):
 
223
  selection: gr.Markdown("Advancing to the next question..."),
224
  forward_btn: gr.Textbox("changed")
225
  }
226
+ btn_p.click(fn = next_p, inputs = [eval_1, eval_2, eval_3], outputs = [selection, scores_p, scores_g, eval_0, eval_1, eval_2, eval_3])
 
227
  btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied], outputs = [selection, forward_btn])
228
 
229
  # Question and answering dynamics