Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
Β·
d503b50
1
Parent(s):
350138b
Transition between questions
Browse files
app.py
CHANGED
@@ -100,13 +100,19 @@ def reset_current_response():
|
|
100 |
with open("question_data.json", "r") as f:
|
101 |
all_questions = json.load(f)
|
102 |
|
|
|
|
|
|
|
103 |
# Loads the user's current question β this is the first question that the user has not made any progress on.
|
104 |
def load_current_question():
|
105 |
global current_question
|
106 |
q_index = user_data["current"]
|
107 |
-
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
110 |
|
111 |
# This method is being used to save each set of individual scores (in case the main files have issues, the data should be saved)
|
112 |
def commit_current_and_reset():
|
@@ -158,7 +164,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
158 |
|
159 |
# Scoring box
|
160 |
with gr.Column(scale = 1) as scores_p:
|
161 |
-
desc_0 = gr.Markdown("Does the passage describe **a legal rule?**")
|
162 |
eval_0 = gr.Radio(["Yes", "No"], label = "Legal Rule?")
|
163 |
desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
|
164 |
eval_1 = gr.Slider(1, 5, step = 0.5, label = "Relevance")
|
@@ -321,6 +327,7 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
321 |
global step
|
322 |
global mode
|
323 |
step = 0
|
|
|
324 |
if mode == 0:
|
325 |
mode = 1 # update mode to 1, will restart with same Q, next set of Ps
|
326 |
print("Next set of passages for same question")
|
|
|
100 |
with open("question_data.json", "r") as f:
|
101 |
all_questions = json.load(f)
|
102 |
|
103 |
+
def test_info():
|
104 |
+
gr.Info("test")
|
105 |
+
|
106 |
# Loads the user's current question β this is the first question that the user has not made any progress on.
|
107 |
def load_current_question():
|
108 |
global current_question
|
109 |
q_index = user_data["current"]
|
110 |
+
if q_index >= len(all_questions):
|
111 |
+
print("Done")
|
112 |
+
gr.Info("You've finished β thank you so much!")
|
113 |
+
else:
|
114 |
+
qid = user_data["order"][q_index]
|
115 |
+
current_question = all_questions[qid]
|
116 |
|
117 |
# This method is being used to save each set of individual scores (in case the main files have issues, the data should be saved)
|
118 |
def commit_current_and_reset():
|
|
|
164 |
|
165 |
# Scoring box
|
166 |
with gr.Column(scale = 1) as scores_p:
|
167 |
+
desc_0 = gr.Markdown("Does the passage describe **a legal rule or principle?**")
|
168 |
eval_0 = gr.Radio(["Yes", "No"], label = "Legal Rule?")
|
169 |
desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
|
170 |
eval_1 = gr.Slider(1, 5, step = 0.5, label = "Relevance")
|
|
|
327 |
global step
|
328 |
global mode
|
329 |
step = 0
|
330 |
+
test_info()
|
331 |
if mode == 0:
|
332 |
mode = 1 # update mode to 1, will restart with same Q, next set of Ps
|
333 |
print("Next set of passages for same question")
|