Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
8ac2e2e
1
Parent(s):
b395c4d
New flow for login
Browse files
app.py
CHANGED
@@ -95,12 +95,14 @@ with gr.Blocks() as user_eval:
|
|
95 |
|
96 |
# Scoring box
|
97 |
with gr.Column(scale = 1) as scores:
|
|
|
|
|
98 |
desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
|
99 |
-
eval_1 = gr.Slider(1, 5, step = 0.5)
|
100 |
desc_2 = gr.Markdown("How would you rate the passage's **quality** in terms of detail, clarity, and focus?")
|
101 |
-
eval_2 = gr.Slider(1, 5, step = 0.5)
|
102 |
desc_3 = gr.Markdown("How effectively does the passage **lead you to the correct answer?**")
|
103 |
-
eval_3 = gr.Slider(1, 5, step = 0.5)
|
104 |
btn = gr.Button("Next")
|
105 |
|
106 |
def next(eval_1, eval_2, eval_3):
|
@@ -121,43 +123,45 @@ with gr.Blocks() as user_eval:
|
|
121 |
btn.click(fn = next, inputs = [eval_1, eval_2, eval_3], outputs = [selection])
|
122 |
|
123 |
# Question and answering dynamics
|
124 |
-
with gr.Row() as question:
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
161 |
|
162 |
# Starts on question, switches to evaluation after the user answers
|
163 |
user_eval.launch()
|
|
|
95 |
|
96 |
# Scoring box
|
97 |
with gr.Column(scale = 1) as scores:
|
98 |
+
desc_0 = gr.Markdown("Does the passage describe **a legal rule?**")
|
99 |
+
eval_0 = gr.Radio(["Yes", "No"], label = "Some passages in our dataset include background details or stories that don't contain any meaningful legal information.")
|
100 |
desc_1 = gr.Markdown("How **relevant** is this passage to the question?")
|
101 |
+
eval_1 = gr.Slider(1, 5, step = 0.5, label = "Does the passage discuss information related to the question?")
|
102 |
desc_2 = gr.Markdown("How would you rate the passage's **quality** in terms of detail, clarity, and focus?")
|
103 |
+
eval_2 = gr.Slider(1, 5, step = 0.5, label = "Is it comprehensible? Is it thorough? Can it stand on its own?")
|
104 |
desc_3 = gr.Markdown("How effectively does the passage **lead you to the correct answer?**")
|
105 |
+
eval_3 = gr.Slider(1, 5, step = 0.5, label = "All things considered, does this passage help a user answer the question correctly?")
|
106 |
btn = gr.Button("Next")
|
107 |
|
108 |
def next(eval_1, eval_2, eval_3):
|
|
|
123 |
btn.click(fn = next, inputs = [eval_1, eval_2, eval_3], outputs = [selection])
|
124 |
|
125 |
# Question and answering dynamics
|
126 |
+
with gr.Row(equal_height = False, visible = False) as question:
|
127 |
+
with gr.Column():
|
128 |
+
gr.Markdown("---")
|
129 |
+
gr.Markdown("**Question**")
|
130 |
+
gr.Markdown(question_text)
|
131 |
+
a = gr.Button(answers_text[0])
|
132 |
+
b = gr.Button(answers_text[1])
|
133 |
+
c = gr.Button(answers_text[2])
|
134 |
+
d = gr.Button(answers_text[3])
|
135 |
+
|
136 |
+
def answer():
|
137 |
+
return {
|
138 |
+
question: gr.Row(visible = False),
|
139 |
+
evals: gr.Row(visible = True)
|
140 |
+
}
|
141 |
+
|
142 |
+
a.click(fn = answer, outputs = [question, evals])
|
143 |
+
b.click(fn = answer, outputs = [question, evals])
|
144 |
+
c.click(fn = answer, outputs = [question, evals])
|
145 |
+
d.click(fn = answer, outputs = [question, evals])
|
146 |
+
|
147 |
+
with gr.Row() as login:
|
148 |
+
with gr.Column():
|
149 |
+
gr.Markdown("---")
|
150 |
+
gr.Markdown("# Enter email to start")
|
151 |
+
gr.Markdown("Thank you so much for your participation in our study! Please enter your email — we're using it to keep track of which questions you've answered and which you haven't seen. Use the same email every time to keep your progress saved. :)")
|
152 |
+
email = gr.Textbox("Email")
|
153 |
+
s = gr.Button("Start!")
|
154 |
+
|
155 |
+
def submit_email(email):
|
156 |
+
global user_id
|
157 |
+
user_id = email
|
158 |
+
print(user_id)
|
159 |
+
return {
|
160 |
+
question: gr.Row(visible = True),
|
161 |
+
login: gr.Row(visible = False)
|
162 |
+
}
|
163 |
+
|
164 |
+
s.click(fn = submit_email, inputs = [email], outputs = [question, login])
|
165 |
|
166 |
# Starts on question, switches to evaluation after the user answers
|
167 |
user_eval.launch()
|