Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
fcda2fa
1
Parent(s):
0bc57b9
Standardize inputs
Browse files
app.py
CHANGED
|
@@ -143,11 +143,11 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 143 |
desc_0 = gr.Markdown("Does the passage describe **a legal rule or principle?**")
|
| 144 |
eval_0 = gr.Radio(["Yes", "No"], label = "Legal Rule?")
|
| 145 |
desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
|
| 146 |
-
eval_1 = gr.Slider(1, 5, step = 0.5, label = "Relevance")
|
| 147 |
desc_2 = gr.Markdown("How would you rate the passage's **quality** in terms of detail, clarity, and focus?")
|
| 148 |
-
eval_2 = gr.Slider(1, 5, step = 0.5, label = "Quality")
|
| 149 |
desc_3 = gr.Markdown("How effectively does the passage **lead you to the correct answer?**")
|
| 150 |
-
eval_3 = gr.Slider(
|
| 151 |
btn_p = gr.Button("Next", interactive = False)
|
| 152 |
# Users must enter in a yes/no value before moving on in the radio area
|
| 153 |
def sanitize_score(rad):
|
|
@@ -159,9 +159,9 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 159 |
|
| 160 |
with gr.Column(scale = 1, visible = False) as scores_g:
|
| 161 |
helps = gr.Markdown("Does this information **help answer** the question?")
|
| 162 |
-
eval_helps = gr.Slider(
|
| 163 |
satisfied = gr.Markdown("How **satisfied** are you by this answer?")
|
| 164 |
-
eval_satisfied = gr.Slider(1, 5, step = 0.5, label = "User Satisfaction")
|
| 165 |
btn_g = gr.Button("Next")
|
| 166 |
|
| 167 |
def next_p(e0, e1, e2, e3):
|
|
@@ -215,8 +215,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 215 |
selection: gr.HTML("""
|
| 216 |
<h2> Autogenerated Response </h2>
|
| 217 |
<p> """ + current_question["generation_" + user_data["modes"][user_data["current"]][mode]] + "</p>"),
|
| 218 |
-
eval_helps: gr.Slider(value =
|
| 219 |
-
eval_satisfied: gr.Slider(value =
|
| 220 |
}
|
| 221 |
# Steps 12 and 13 are gold passage + gold passage generation IF it is applicable
|
| 222 |
if step > 11: # and not current_question["top10_contains_gold_passage"]
|
|
@@ -229,8 +229,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 229 |
<h2> Retrieved Passage </h2>
|
| 230 |
<p> """ + current_question["top10_" + user_data["modes"][user_data["current"]][1]][0] + "</p>"), # hard coded: first passage (0) of mode 2 (1),
|
| 231 |
forward_btn: gr.Textbox("load new data"),
|
| 232 |
-
eval_helps: gr.Slider(value =
|
| 233 |
-
eval_satisfied: gr.Slider(value =
|
| 234 |
}
|
| 235 |
# When mode is 1 -> display GP and GP generation, then switch
|
| 236 |
if step == 12:
|
|
@@ -241,8 +241,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 241 |
<h2> Retrieved Passage </h2>
|
| 242 |
<p> """ + current_question["gold_passage"] + "</p>"),
|
| 243 |
forward_btn: gr.Textbox(),
|
| 244 |
-
eval_helps: gr.Slider(value =
|
| 245 |
-
eval_satisfied: gr.Slider(value =
|
| 246 |
}
|
| 247 |
elif step == 13:
|
| 248 |
# The user just evaluated the gold passage
|
|
@@ -252,8 +252,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 252 |
<h2> Autogenerated Response </h2>
|
| 253 |
<p> """ + current_question["gold_passage_generation"] + "</p>"),
|
| 254 |
forward_btn: gr.Textbox(),
|
| 255 |
-
eval_helps: gr.Slider(value =
|
| 256 |
-
eval_satisfied: gr.Slider(value =
|
| 257 |
}
|
| 258 |
else: # step = 14
|
| 259 |
# The user just evaluated the gold passage generation
|
|
@@ -265,8 +265,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 265 |
return {
|
| 266 |
selection: gr.Markdown("Advancing to the next question..."),
|
| 267 |
forward_btn: gr.Textbox("changed"),
|
| 268 |
-
eval_helps: gr.Slider(value =
|
| 269 |
-
eval_satisfied: gr.Slider(value =
|
| 270 |
}
|
| 271 |
|
| 272 |
# VERY UNCLEAN CODE: for practical purposes, this else block is unreachable: not current_question["top10_contains_gold_passage"] will always be True
|
|
|
|
| 143 |
desc_0 = gr.Markdown("Does the passage describe **a legal rule or principle?**")
|
| 144 |
eval_0 = gr.Radio(["Yes", "No"], label = "Legal Rule?")
|
| 145 |
desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
|
| 146 |
+
eval_1 = gr.Slider(1, 5, step = 0.5, label = "Relevance", value = 3)
|
| 147 |
desc_2 = gr.Markdown("How would you rate the passage's **quality** in terms of detail, clarity, and focus?")
|
| 148 |
+
eval_2 = gr.Slider(1, 5, step = 0.5, label = "Quality", value = 3)
|
| 149 |
desc_3 = gr.Markdown("How effectively does the passage **lead you to the correct answer?**")
|
| 150 |
+
eval_3 = gr.Slider(-2, 2, step = 0.5, label = "Helpfulness", value = 0)
|
| 151 |
btn_p = gr.Button("Next", interactive = False)
|
| 152 |
# Users must enter in a yes/no value before moving on in the radio area
|
| 153 |
def sanitize_score(rad):
|
|
|
|
| 159 |
|
| 160 |
with gr.Column(scale = 1, visible = False) as scores_g:
|
| 161 |
helps = gr.Markdown("Does this information **help answer** the question?")
|
| 162 |
+
eval_helps = gr.Slider(-2, 2, step = 0.5, label = "Helpfulness", value = 0)
|
| 163 |
satisfied = gr.Markdown("How **satisfied** are you by this answer?")
|
| 164 |
+
eval_satisfied = gr.Slider(1, 5, step = 0.5, label = "User Satisfaction", value = 3)
|
| 165 |
btn_g = gr.Button("Next")
|
| 166 |
|
| 167 |
def next_p(e0, e1, e2, e3):
|
|
|
|
| 215 |
selection: gr.HTML("""
|
| 216 |
<h2> Autogenerated Response </h2>
|
| 217 |
<p> """ + current_question["generation_" + user_data["modes"][user_data["current"]][mode]] + "</p>"),
|
| 218 |
+
eval_helps: gr.Slider(value = 0),
|
| 219 |
+
eval_satisfied: gr.Slider(value = 3)
|
| 220 |
}
|
| 221 |
# Steps 12 and 13 are gold passage + gold passage generation IF it is applicable
|
| 222 |
if step > 11: # and not current_question["top10_contains_gold_passage"]
|
|
|
|
| 229 |
<h2> Retrieved Passage </h2>
|
| 230 |
<p> """ + current_question["top10_" + user_data["modes"][user_data["current"]][1]][0] + "</p>"), # hard coded: first passage (0) of mode 2 (1),
|
| 231 |
forward_btn: gr.Textbox("load new data"),
|
| 232 |
+
eval_helps: gr.Slider(value = 0),
|
| 233 |
+
eval_satisfied: gr.Slider(value = 3)
|
| 234 |
}
|
| 235 |
# When mode is 1 -> display GP and GP generation, then switch
|
| 236 |
if step == 12:
|
|
|
|
| 241 |
<h2> Retrieved Passage </h2>
|
| 242 |
<p> """ + current_question["gold_passage"] + "</p>"),
|
| 243 |
forward_btn: gr.Textbox(),
|
| 244 |
+
eval_helps: gr.Slider(value = 0),
|
| 245 |
+
eval_satisfied: gr.Slider(value = 3)
|
| 246 |
}
|
| 247 |
elif step == 13:
|
| 248 |
# The user just evaluated the gold passage
|
|
|
|
| 252 |
<h2> Autogenerated Response </h2>
|
| 253 |
<p> """ + current_question["gold_passage_generation"] + "</p>"),
|
| 254 |
forward_btn: gr.Textbox(),
|
| 255 |
+
eval_helps: gr.Slider(value = 0),
|
| 256 |
+
eval_satisfied: gr.Slider(value = 3)
|
| 257 |
}
|
| 258 |
else: # step = 14
|
| 259 |
# The user just evaluated the gold passage generation
|
|
|
|
| 265 |
return {
|
| 266 |
selection: gr.Markdown("Advancing to the next question..."),
|
| 267 |
forward_btn: gr.Textbox("changed"),
|
| 268 |
+
eval_helps: gr.Slider(value = 0),
|
| 269 |
+
eval_satisfied: gr.Slider(value = 3)
|
| 270 |
}
|
| 271 |
|
| 272 |
# VERY UNCLEAN CODE: for practical purposes, this else block is unreachable: not current_question["top10_contains_gold_passage"] will always be True
|