Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
95069fa
1
Parent(s):
24df3fa
State?
Browse files
app.py
CHANGED
@@ -191,7 +191,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
191 |
}
|
192 |
|
193 |
# Loads the user's current question — this is the first question that the user has not made any progress on.
|
194 |
-
def load_current_question():
|
195 |
q_index = user_data["current"]
|
196 |
if q_index >= len(all_questions):
|
197 |
print("Done")
|
@@ -370,7 +370,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
370 |
user_data["current"] += 1
|
371 |
user_data["responses"].append(current_response) # adds new answers to current list of responses
|
372 |
update_huggingface(user_id) # persistence — update progress online, save answers
|
373 |
-
load_current_question()
|
374 |
return {
|
375 |
selection: gr.Markdown("Advancing to the next question..."),
|
376 |
forward_btn: gr.Textbox("changed" + str(user_data["current"])), # current forces event to trigger always
|
@@ -497,7 +497,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
497 |
user_id = email
|
498 |
user_data = load_user_data(user_id) # calls login, downloads data, initializes session
|
499 |
# After loading user data, update with current question
|
500 |
-
current_question = load_current_question()
|
501 |
new_answers = current_question["answers"].copy()
|
502 |
new_answers[current_question["correct_answer_index"]] = "**" + current_question["answers"][current_question["correct_answer_index"]] + "** ✅"
|
503 |
return {
|
|
|
191 |
}
|
192 |
|
193 |
# Loads the user's current question — this is the first question that the user has not made any progress on.
|
194 |
+
def load_current_question(user_data):
|
195 |
q_index = user_data["current"]
|
196 |
if q_index >= len(all_questions):
|
197 |
print("Done")
|
|
|
370 |
user_data["current"] += 1
|
371 |
user_data["responses"].append(current_response) # adds new answers to current list of responses
|
372 |
update_huggingface(user_id) # persistence — update progress online, save answers
|
373 |
+
current_question = load_current_question(user_data)
|
374 |
return {
|
375 |
selection: gr.Markdown("Advancing to the next question..."),
|
376 |
forward_btn: gr.Textbox("changed" + str(user_data["current"])), # current forces event to trigger always
|
|
|
497 |
user_id = email
|
498 |
user_data = load_user_data(user_id) # calls login, downloads data, initializes session
|
499 |
# After loading user data, update with current question
|
500 |
+
current_question = load_current_question(user_data)
|
501 |
new_answers = current_question["answers"].copy()
|
502 |
new_answers[current_question["correct_answer_index"]] = "**" + current_question["answers"][current_question["correct_answer_index"]] + "** ✅"
|
503 |
return {
|