Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
350138b
1
Parent(s):
87c5ef7
Transition between questions
Browse files
app.py
CHANGED
|
@@ -333,6 +333,8 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 333 |
else:
|
| 334 |
mode = 0 # reset mode to 0, will restart with new Q (set up new Q), first set of Ps
|
| 335 |
print("New question")
|
|
|
|
|
|
|
| 336 |
return {
|
| 337 |
scores_p: gr.Column(visible = True),
|
| 338 |
scores_g: gr.Column(visible = False),
|
|
@@ -342,10 +344,24 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 342 |
a: gr.Button(current_question["answers"][0]),
|
| 343 |
b: gr.Button(current_question["answers"][1]),
|
| 344 |
c: gr.Button(current_question["answers"][2]),
|
| 345 |
-
d: gr.Button(current_question["answers"][3])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
}
|
| 347 |
|
| 348 |
-
forward_btn.change(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question, q_text, a, b, c, d])
|
| 349 |
|
| 350 |
with gr.Row() as login:
|
| 351 |
with gr.Column():
|
|
|
|
| 333 |
else:
|
| 334 |
mode = 0 # reset mode to 0, will restart with new Q (set up new Q), first set of Ps
|
| 335 |
print("New question")
|
| 336 |
+
new_answers = current_question["answers"].copy()
|
| 337 |
+
new_answers[current_question["correct_answer_index"]] = "**" + current_question["answers"][current_question["correct_answer_index"]] + "** ✅"
|
| 338 |
return {
|
| 339 |
scores_p: gr.Column(visible = True),
|
| 340 |
scores_g: gr.Column(visible = False),
|
|
|
|
| 344 |
a: gr.Button(current_question["answers"][0]),
|
| 345 |
b: gr.Button(current_question["answers"][1]),
|
| 346 |
c: gr.Button(current_question["answers"][2]),
|
| 347 |
+
d: gr.Button(current_question["answers"][3]),
|
| 348 |
+
passage_display: gr.Markdown("""
|
| 349 |
+
## Question and Answer
|
| 350 |
+
*""" + current_question["question"] +
|
| 351 |
+
"""* \n
|
| 352 |
+
+ """ + new_answers[0] +
|
| 353 |
+
""" \n
|
| 354 |
+
+ """ + new_answers[1] +
|
| 355 |
+
""" \n
|
| 356 |
+
+ """ + new_answers[2] +
|
| 357 |
+
""" \n
|
| 358 |
+
+ """ + new_answers[3]),
|
| 359 |
+
selection: gr.HTML("""
|
| 360 |
+
<h2> Retrieved Passage </h2>
|
| 361 |
+
<p> """ + current_question["top10_" + user_data["modes"][user_data["current"]][mode]][0] + "</p>")
|
| 362 |
}
|
| 363 |
|
| 364 |
+
forward_btn.change(fn = toggle, inputs = None, outputs = [scores_p, scores_g, evals, question, q_text, a, b, c, d, passage_display, selection])
|
| 365 |
|
| 366 |
with gr.Row() as login:
|
| 367 |
with gr.Column():
|