sutdaiday
commited on
Commit
Β·
2a9914a
1
Parent(s):
d9100b7
fixed
Browse files- ambuj_CraigslistBargain_results.csv +2 -0
- ambuj_ESConv_results.csv +5 -0
- app.py +118 -89
- requirements.txt +1 -1
ambuj_CraigslistBargain_results.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
UserID,Dataset,Background,Response A Method,Response B Method,Persuasiveness,Coherence,Naturalness,Overall
|
| 2 |
+
ambuj,CraigslistBargain,User interested in a set of textbooks priced at $120.,Ours,PPDPP,Prefer Response A,Prefer Response B,Prefer Response B,Prefer Response B
|
ambuj_ESConv_results.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
UserID,Dataset,Background,Response A Method,Response B Method,Identification,Comforting,Suggestion,Overall
|
| 2 |
+
ambuj,ESConv,User misses family who live overseas and feels homesick.,PPDPP,Ours,Prefer Response B,Prefer Response B,Prefer Response A,Prefer Response A
|
| 3 |
+
ambuj,ESConv,User complains of creative block when starting a new art project.,DPDP,Ours,Prefer Response A,Prefer Response A,Prefer Response A,Prefer Response B
|
| 4 |
+
ambuj,ESConv,User feels bombarded by negative social media comparisons.,DPDP,Ours,No preference,Prefer Response B,Prefer Response B,Prefer Response A
|
| 5 |
+
ambuj,ESConv,User expresses fear about planning a solo travel adventure.,Ours,DPDP,Prefer Response A,Prefer Response B,Prefer Response A,Prefer Response B
|
app.py
CHANGED
|
@@ -320,79 +320,79 @@ def cb_prev_fn(user_id, dataset, examples, idx, responses, per, coh, nat, ovl_cb
|
|
| 320 |
|
| 321 |
|
| 322 |
# βββ Build Gradio App ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 323 |
-
|
| 324 |
-
with gr.Blocks() as demo: # β title arg removed here!
|
| 325 |
-
|
| 326 |
# ββ Login ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 327 |
with gr.Column() as login_panel:
|
| 328 |
gr.Markdown("## Human Evaluation Survey")
|
| 329 |
user_id_in = gr.Textbox(label="User ID")
|
| 330 |
-
ds_dd
|
| 331 |
-
start_btn
|
| 332 |
-
|
| 333 |
-
#
|
| 334 |
-
uid_state
|
| 335 |
-
ds_state
|
| 336 |
-
ex_state
|
| 337 |
-
idx_state
|
| 338 |
resp_state = gr.State({})
|
| 339 |
|
| 340 |
# ββ ESConv Panel ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 341 |
with gr.Column(visible=False) as es_panel:
|
| 342 |
-
bg
|
| 343 |
with gr.Row():
|
| 344 |
lbox = gr.Textbox(label="Response A", interactive=False)
|
| 345 |
rbox = gr.Textbox(label="Response B", interactive=False)
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
|
|
|
| 364 |
with gr.Row():
|
| 365 |
-
prev_btn
|
| 366 |
-
next_btn
|
| 367 |
logout_es = gr.Button("πͺ Logout")
|
| 368 |
|
| 369 |
# ββ CraigslistBargain Panel ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 370 |
with gr.Column(visible=False) as cb_panel:
|
| 371 |
-
bg_cb
|
| 372 |
with gr.Row():
|
| 373 |
lbox_cb = gr.Textbox(label="Response A", interactive=False)
|
| 374 |
rbox_cb = gr.Textbox(label="Response B", interactive=False)
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
|
|
|
| 392 |
prog_cb = gr.Text(label="Progress")
|
| 393 |
with gr.Row():
|
| 394 |
-
prev_cb
|
| 395 |
-
next_cb
|
| 396 |
logout_cb = gr.Button("πͺ Logout")
|
| 397 |
|
| 398 |
# ββ Wiring βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
@@ -400,67 +400,96 @@ with gr.Blocks() as demo: # β title arg removed here!
|
|
| 400 |
login_fn,
|
| 401 |
inputs=[user_id_in, ds_dd],
|
| 402 |
outputs=[
|
| 403 |
-
login_panel,
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
],
|
| 410 |
)
|
| 411 |
|
| 412 |
# ESConv navigation
|
| 413 |
next_btn.click(
|
| 414 |
es_next_fn,
|
| 415 |
-
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state,
|
| 416 |
-
|
| 417 |
-
outputs=[bg, lbox, rbox, prog, idx_state, resp_state,
|
| 418 |
-
ident, com, sug, ovl_es, err_es],
|
| 419 |
)
|
| 420 |
prev_btn.click(
|
| 421 |
es_prev_fn,
|
| 422 |
-
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state,
|
| 423 |
-
|
| 424 |
-
outputs=[bg, lbox, rbox, prog, idx_state, resp_state,
|
| 425 |
-
ident, com, sug, ovl_es, err_es],
|
| 426 |
)
|
| 427 |
|
| 428 |
# CB navigation
|
| 429 |
next_cb.click(
|
| 430 |
cb_next_fn,
|
| 431 |
-
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state,
|
| 432 |
-
|
| 433 |
-
outputs=[bg_cb, lbox_cb, rbox_cb, prog_cb, idx_state, resp_state,
|
| 434 |
-
per, coh, nat, ovl_cb, err_cb],
|
| 435 |
)
|
| 436 |
prev_cb.click(
|
| 437 |
cb_prev_fn,
|
| 438 |
-
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state,
|
| 439 |
-
|
| 440 |
-
outputs=[bg_cb, lbox_cb, rbox_cb, prog_cb, idx_state, resp_state,
|
| 441 |
-
per, coh, nat, ovl_cb, err_cb],
|
| 442 |
)
|
| 443 |
|
| 444 |
-
# Logout (
|
| 445 |
-
for
|
| 446 |
-
|
| 447 |
logout_fn,
|
| 448 |
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state],
|
| 449 |
outputs=[
|
| 450 |
-
login_panel,
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
],
|
| 457 |
)
|
| 458 |
|
| 459 |
# βββ Run βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 460 |
if __name__ == "__main__":
|
| 461 |
-
demo.launch(share=True)
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
# βββ Run βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 465 |
-
if __name__ == "__main__":
|
| 466 |
-
demo.launch(share=True)
|
|
|
|
| 320 |
|
| 321 |
|
| 322 |
# βββ Build Gradio App ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 323 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
| 324 |
# ββ Login ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 325 |
with gr.Column() as login_panel:
|
| 326 |
gr.Markdown("## Human Evaluation Survey")
|
| 327 |
user_id_in = gr.Textbox(label="User ID")
|
| 328 |
+
ds_dd = gr.Dropdown(list(DATASET_FILES.keys()), label="Select dataset")
|
| 329 |
+
start_btn = gr.Button("Start survey")
|
| 330 |
+
|
| 331 |
+
# Shared state
|
| 332 |
+
uid_state = gr.State("")
|
| 333 |
+
ds_state = gr.State("")
|
| 334 |
+
ex_state = gr.State([])
|
| 335 |
+
idx_state = gr.State(0)
|
| 336 |
resp_state = gr.State({})
|
| 337 |
|
| 338 |
# ββ ESConv Panel ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 339 |
with gr.Column(visible=False) as es_panel:
|
| 340 |
+
bg = gr.Textbox(label="Background context", interactive=False)
|
| 341 |
with gr.Row():
|
| 342 |
lbox = gr.Textbox(label="Response A", interactive=False)
|
| 343 |
rbox = gr.Textbox(label="Response B", interactive=False)
|
| 344 |
+
|
| 345 |
+
ident = gr.Radio(
|
| 346 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 347 |
+
label="Identification (Ident.)",
|
| 348 |
+
)
|
| 349 |
+
com = gr.Radio(
|
| 350 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 351 |
+
label="Comforting (Com.)",
|
| 352 |
+
)
|
| 353 |
+
sug = gr.Radio(
|
| 354 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 355 |
+
label="Suggestion (Sug.)",
|
| 356 |
+
)
|
| 357 |
+
ovl_es = gr.Radio(
|
| 358 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 359 |
+
label="Overall (Ov.)",
|
| 360 |
+
)
|
| 361 |
+
err_es = gr.HTML(visible=False)
|
| 362 |
+
prog = gr.Text(label="Progress")
|
| 363 |
with gr.Row():
|
| 364 |
+
prev_btn = gr.Button("β Prev")
|
| 365 |
+
next_btn = gr.Button("βΆ Next")
|
| 366 |
logout_es = gr.Button("πͺ Logout")
|
| 367 |
|
| 368 |
# ββ CraigslistBargain Panel ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 369 |
with gr.Column(visible=False) as cb_panel:
|
| 370 |
+
bg_cb = gr.Textbox(label="Background context", interactive=False)
|
| 371 |
with gr.Row():
|
| 372 |
lbox_cb = gr.Textbox(label="Response A", interactive=False)
|
| 373 |
rbox_cb = gr.Textbox(label="Response B", interactive=False)
|
| 374 |
+
|
| 375 |
+
per = gr.Radio(
|
| 376 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 377 |
+
label="Persuasiveness (Per.)",
|
| 378 |
+
)
|
| 379 |
+
coh = gr.Radio(
|
| 380 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 381 |
+
label="Coherence (Coh.)",
|
| 382 |
+
)
|
| 383 |
+
nat = gr.Radio(
|
| 384 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 385 |
+
label="Naturalness (Nat.)",
|
| 386 |
+
)
|
| 387 |
+
ovl_cb = gr.Radio(
|
| 388 |
+
["Prefer Response A", "Prefer Response B", "No preference"],
|
| 389 |
+
label="Overall",
|
| 390 |
+
)
|
| 391 |
+
err_cb = gr.HTML(visible=False)
|
| 392 |
prog_cb = gr.Text(label="Progress")
|
| 393 |
with gr.Row():
|
| 394 |
+
prev_cb = gr.Button("β Prev")
|
| 395 |
+
next_cb = gr.Button("βΆ Next")
|
| 396 |
logout_cb = gr.Button("πͺ Logout")
|
| 397 |
|
| 398 |
# ββ Wiring βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 400 |
login_fn,
|
| 401 |
inputs=[user_id_in, ds_dd],
|
| 402 |
outputs=[
|
| 403 |
+
login_panel,
|
| 404 |
+
es_panel,
|
| 405 |
+
cb_panel,
|
| 406 |
+
uid_state,
|
| 407 |
+
ds_state,
|
| 408 |
+
ex_state,
|
| 409 |
+
idx_state,
|
| 410 |
+
resp_state,
|
| 411 |
+
# ESConv
|
| 412 |
+
bg,
|
| 413 |
+
lbox,
|
| 414 |
+
rbox,
|
| 415 |
+
prog,
|
| 416 |
+
ident,
|
| 417 |
+
com,
|
| 418 |
+
sug,
|
| 419 |
+
ovl_es,
|
| 420 |
+
err_es,
|
| 421 |
+
# CB
|
| 422 |
+
bg_cb,
|
| 423 |
+
lbox_cb,
|
| 424 |
+
rbox_cb,
|
| 425 |
+
prog_cb,
|
| 426 |
+
per,
|
| 427 |
+
coh,
|
| 428 |
+
nat,
|
| 429 |
+
ovl_cb,
|
| 430 |
+
err_cb,
|
| 431 |
],
|
| 432 |
)
|
| 433 |
|
| 434 |
# ESConv navigation
|
| 435 |
next_btn.click(
|
| 436 |
es_next_fn,
|
| 437 |
+
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state, ident, com, sug, ovl_es],
|
| 438 |
+
outputs=[bg, lbox, rbox, prog, idx_state, resp_state, ident, com, sug, ovl_es, err_es],
|
|
|
|
|
|
|
| 439 |
)
|
| 440 |
prev_btn.click(
|
| 441 |
es_prev_fn,
|
| 442 |
+
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state, ident, com, sug, ovl_es],
|
| 443 |
+
outputs=[bg, lbox, rbox, prog, idx_state, resp_state, ident, com, sug, ovl_es, err_es],
|
|
|
|
|
|
|
| 444 |
)
|
| 445 |
|
| 446 |
# CB navigation
|
| 447 |
next_cb.click(
|
| 448 |
cb_next_fn,
|
| 449 |
+
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state, per, coh, nat, ovl_cb],
|
| 450 |
+
outputs=[bg_cb, lbox_cb, rbox_cb, prog_cb, idx_state, resp_state, per, coh, nat, ovl_cb, err_cb],
|
|
|
|
|
|
|
| 451 |
)
|
| 452 |
prev_cb.click(
|
| 453 |
cb_prev_fn,
|
| 454 |
+
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state, per, coh, nat, ovl_cb],
|
| 455 |
+
outputs=[bg_cb, lbox_cb, rbox_cb, prog_cb, idx_state, resp_state, per, coh, nat, ovl_cb, err_cb],
|
|
|
|
|
|
|
| 456 |
)
|
| 457 |
|
| 458 |
+
# Logout buttons (both panels share same callback)
|
| 459 |
+
for logout_btn in (logout_es, logout_cb):
|
| 460 |
+
logout_btn.click(
|
| 461 |
logout_fn,
|
| 462 |
inputs=[uid_state, ds_state, ex_state, idx_state, resp_state],
|
| 463 |
outputs=[
|
| 464 |
+
login_panel,
|
| 465 |
+
es_panel,
|
| 466 |
+
cb_panel,
|
| 467 |
+
uid_state,
|
| 468 |
+
ds_state,
|
| 469 |
+
ex_state,
|
| 470 |
+
idx_state,
|
| 471 |
+
resp_state,
|
| 472 |
+
bg,
|
| 473 |
+
lbox,
|
| 474 |
+
rbox,
|
| 475 |
+
prog,
|
| 476 |
+
ident,
|
| 477 |
+
com,
|
| 478 |
+
sug,
|
| 479 |
+
ovl_es,
|
| 480 |
+
err_es,
|
| 481 |
+
bg_cb,
|
| 482 |
+
lbox_cb,
|
| 483 |
+
rbox_cb,
|
| 484 |
+
prog_cb,
|
| 485 |
+
per,
|
| 486 |
+
coh,
|
| 487 |
+
nat,
|
| 488 |
+
ovl_cb,
|
| 489 |
+
err_cb,
|
| 490 |
],
|
| 491 |
)
|
| 492 |
|
| 493 |
# βββ Run βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 494 |
if __name__ == "__main__":
|
| 495 |
+
demo.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
gradio
|
| 2 |
pandas
|
|
|
|
| 1 |
+
gradio=3.6.0
|
| 2 |
pandas
|