Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
43d4f11
1
Parent(s):
9815e83
State?
Browse files
app.py
CHANGED
|
@@ -258,7 +258,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 258 |
eval_satisfied = gr.Slider(1, 5, step = 0.5, label = "User Satisfaction", value = 3)
|
| 259 |
btn_g = gr.Button("Next")
|
| 260 |
|
| 261 |
-
def next_p(e0, e1, e2, e3, cur_step, mode, cr):
|
| 262 |
step = cur_step + 1
|
| 263 |
# Add user data to the current response
|
| 264 |
print(cr)
|
|
@@ -301,7 +301,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 301 |
current_response: cr
|
| 302 |
}
|
| 303 |
|
| 304 |
-
def next_g(e_h, e_s, cur_step, mode, ud, cr):
|
| 305 |
step = cur_step + 1
|
| 306 |
|
| 307 |
if step == 11:
|
|
@@ -374,7 +374,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 374 |
ud["current"] += 1
|
| 375 |
ud["responses"].append(cr) # adds new answers to current list of responses
|
| 376 |
update_huggingface(user_id) # persistence — update progress online, save answers
|
| 377 |
-
|
| 378 |
return {
|
| 379 |
selection: gr.Markdown("Advancing to the next question..."),
|
| 380 |
forward_btn: gr.Textbox("changed" + str(user_data["current"])), # current forces event to trigger always
|
|
@@ -383,11 +383,12 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
| 383 |
step: step,
|
| 384 |
mode: mode,
|
| 385 |
user_data: ud,
|
| 386 |
-
current_response: cr
|
|
|
|
| 387 |
}
|
| 388 |
|
| 389 |
-
btn_p.click(fn = next_p, inputs = [eval_0, eval_1, eval_2, eval_3, step, mode, current_response], outputs = [selection, scores_p, scores_g, eval_0, eval_1, eval_2, eval_3, step, mode, current_response])
|
| 390 |
-
btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied, step, mode, user_data, current_response], outputs = [selection, forward_btn, eval_helps, eval_satisfied, step, mode, user_data, current_response])
|
| 391 |
|
| 392 |
# Question and answering dynamics
|
| 393 |
with gr.Row(equal_height = False, visible = False) as question:
|
|
|
|
| 258 |
eval_satisfied = gr.Slider(1, 5, step = 0.5, label = "User Satisfaction", value = 3)
|
| 259 |
btn_g = gr.Button("Next")
|
| 260 |
|
| 261 |
+
def next_p(e0, e1, e2, e3, cur_step, mode, cr, cq):
|
| 262 |
step = cur_step + 1
|
| 263 |
# Add user data to the current response
|
| 264 |
print(cr)
|
|
|
|
| 301 |
current_response: cr
|
| 302 |
}
|
| 303 |
|
| 304 |
+
def next_g(e_h, e_s, cur_step, mode, ud, cr, cq):
|
| 305 |
step = cur_step + 1
|
| 306 |
|
| 307 |
if step == 11:
|
|
|
|
| 374 |
ud["current"] += 1
|
| 375 |
ud["responses"].append(cr) # adds new answers to current list of responses
|
| 376 |
update_huggingface(user_id) # persistence — update progress online, save answers
|
| 377 |
+
cq, cr = load_current_question(ud, user_id)
|
| 378 |
return {
|
| 379 |
selection: gr.Markdown("Advancing to the next question..."),
|
| 380 |
forward_btn: gr.Textbox("changed" + str(user_data["current"])), # current forces event to trigger always
|
|
|
|
| 383 |
step: step,
|
| 384 |
mode: mode,
|
| 385 |
user_data: ud,
|
| 386 |
+
current_response: cr,
|
| 387 |
+
current_question: cq
|
| 388 |
}
|
| 389 |
|
| 390 |
+
btn_p.click(fn = next_p, inputs = [eval_0, eval_1, eval_2, eval_3, step, mode, current_response, current_question], outputs = [selection, scores_p, scores_g, eval_0, eval_1, eval_2, eval_3, step, mode, current_response])
|
| 391 |
+
btn_g.click(fn = next_g, inputs = [eval_helps, eval_satisfied, step, mode, user_data, current_response, current_question], outputs = [selection, forward_btn, eval_helps, eval_satisfied, step, mode, user_data, current_response, current_question])
|
| 392 |
|
| 393 |
# Question and answering dynamics
|
| 394 |
with gr.Row(equal_height = False, visible = False) as question:
|