Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
Β·
7ea5a5c
1
Parent(s):
07e7d16
State?
Browse files
app.py
CHANGED
@@ -176,10 +176,10 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
176 |
token = os.getenv("HF_TOKEN")
|
177 |
)
|
178 |
|
179 |
-
def reset_current_response(qid,
|
180 |
return {
|
181 |
current_response : {
|
182 |
-
"user_id":
|
183 |
"question_id": qid,
|
184 |
"user_answer": 0,
|
185 |
"e5_scores": [], # list of ten [score, score, score, score]
|
@@ -194,16 +194,16 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
194 |
}
|
195 |
|
196 |
# Loads the user's current question β this is the first question that the user has not made any progress on.
|
197 |
-
def load_current_question(user_data
|
198 |
q_index = user_data["current"]
|
199 |
if q_index >= len(all_questions):
|
200 |
print("Done")
|
201 |
gr.Info("You've finished β thank you so much! There are no more questions. :)")
|
202 |
-
new_response = reset_current_response("USER FINISHED", user_id)
|
203 |
return {"question": "You're done! Thanks so much for your help.", "answers": ["I want to log out now.", "I want to keep answering questions.","I want to keep answering questions.", "I want to keep answering questions."], "correct_answer_index": 0, "top10_e5": ["You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!"], "generation_e5": "I don't know how to exit this code right now, so you're in an endless loop of this question until you quit.", "top10_colbert": ["You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!"], "generation_colbert": "I don't know how to exit this code right now, so you're in an endless loop of this question until you quit.", "top10_contains_gold_passage": False, "gold_passage": "GOLD PASSAGE: LOG OFF!", "gold_passage_generation": "what do you gain"}, new_response
|
204 |
else:
|
205 |
qid = user_data["order"][q_index]
|
206 |
-
new_response = reset_current_response(user_data["order"][q_index], user_id)
|
207 |
return all_questions[qid], new_response
|
208 |
|
209 |
|
|
|
176 |
token = os.getenv("HF_TOKEN")
|
177 |
)
|
178 |
|
179 |
+
def reset_current_response(qid, uid):
|
180 |
return {
|
181 |
current_response : {
|
182 |
+
"user_id": uid,
|
183 |
"question_id": qid,
|
184 |
"user_answer": 0,
|
185 |
"e5_scores": [], # list of ten [score, score, score, score]
|
|
|
194 |
}
|
195 |
|
196 |
# Loads the user's current question β this is the first question that the user has not made any progress on.
|
197 |
+
def load_current_question(user_data):
|
198 |
q_index = user_data["current"]
|
199 |
if q_index >= len(all_questions):
|
200 |
print("Done")
|
201 |
gr.Info("You've finished β thank you so much! There are no more questions. :)")
|
202 |
+
new_response = reset_current_response("USER FINISHED", user_data["user_id"])
|
203 |
return {"question": "You're done! Thanks so much for your help.", "answers": ["I want to log out now.", "I want to keep answering questions.","I want to keep answering questions.", "I want to keep answering questions."], "correct_answer_index": 0, "top10_e5": ["You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!"], "generation_e5": "I don't know how to exit this code right now, so you're in an endless loop of this question until you quit.", "top10_colbert": ["You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!", "You're done; thank you!"], "generation_colbert": "I don't know how to exit this code right now, so you're in an endless loop of this question until you quit.", "top10_contains_gold_passage": False, "gold_passage": "GOLD PASSAGE: LOG OFF!", "gold_passage_generation": "what do you gain"}, new_response
|
204 |
else:
|
205 |
qid = user_data["order"][q_index]
|
206 |
+
new_response = reset_current_response(user_data["order"][q_index], user_data["user_id"])
|
207 |
return all_questions[qid], new_response
|
208 |
|
209 |
|