Spaces:
Sleeping
Sleeping
elibrowne
commited on
Commit
·
0bc57b9
1
Parent(s):
8861533
Also listen for user answer
Browse files
app.py
CHANGED
@@ -308,16 +308,40 @@ with gr.Blocks(theme = theme) as user_eval:
|
|
308 |
c = gr.Button("C")
|
309 |
d = gr.Button("D")
|
310 |
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
return {
|
313 |
question: gr.Row(visible = False),
|
314 |
evals: gr.Row(visible = True)
|
315 |
}
|
316 |
|
317 |
-
a.click(fn =
|
318 |
-
b.click(fn =
|
319 |
-
c.click(fn =
|
320 |
-
d.click(fn =
|
321 |
|
322 |
def toggle():
|
323 |
global step
|
|
|
308 |
c = gr.Button("C")
|
309 |
d = gr.Button("D")
|
310 |
|
311 |
+
# I know this is inefficient...
|
312 |
+
def answer_a():
|
313 |
+
global current_response
|
314 |
+
current_response["user_answer"] = 0
|
315 |
+
return {
|
316 |
+
question: gr.Row(visible = False),
|
317 |
+
evals: gr.Row(visible = True)
|
318 |
+
}
|
319 |
+
def answer_b():
|
320 |
+
global current_response
|
321 |
+
current_response["user_answer"] = 1
|
322 |
+
return {
|
323 |
+
question: gr.Row(visible = False),
|
324 |
+
evals: gr.Row(visible = True)
|
325 |
+
}
|
326 |
+
def answer_c():
|
327 |
+
global current_response
|
328 |
+
current_response["user_answer"] = 2
|
329 |
+
return {
|
330 |
+
question: gr.Row(visible = False),
|
331 |
+
evals: gr.Row(visible = True)
|
332 |
+
}
|
333 |
+
def answer_d():
|
334 |
+
global current_response
|
335 |
+
current_response["user_answer"] = 3
|
336 |
return {
|
337 |
question: gr.Row(visible = False),
|
338 |
evals: gr.Row(visible = True)
|
339 |
}
|
340 |
|
341 |
+
a.click(fn = answer_a, outputs = [question, evals])
|
342 |
+
b.click(fn = answer_b, outputs = [question, evals])
|
343 |
+
c.click(fn = answer_c, outputs = [question, evals])
|
344 |
+
d.click(fn = answer_d, outputs = [question, evals])
|
345 |
|
346 |
def toggle():
|
347 |
global step
|