forouzanfallah commited on
Commit
d285015
·
verified ·
1 Parent(s): d7004d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -410,7 +410,10 @@ def submit_finish(
410
  gr.update(value=5), gr.update(value=5), gr.update(value=5), gr.update(value=5), gr.update(value=5),
411
  gr.update(value=None),
412
  )
413
-
 
 
 
414
  def submit_next_image(
415
  name: str,
416
  email: str,
@@ -626,7 +629,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
626
 
627
  with gr.Row():
628
  submit_next_btn = gr.Button("Submit & Next Image", variant="primary")
629
- submit_finish_btn = gr.Button("Submit & Exit", variant="secondary")
630
 
631
  # your_jsonl_path = gr.Textbox(label="Your results file path (for reference)", interactive=False)
632
  your_jsonl_path = gr.State()
@@ -648,16 +651,15 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
648
  )
649
  start_event.then(hide_thanks, inputs=None, outputs=[thanks_group])
650
 
651
- finish_event = submit_finish_btn.click(
652
- submit_finish,
653
- inputs=[name, email, state_uid, state_samples, state_seen, state_idx,
654
- score_1, score_2, score_3, score_4, score_5, notes_q1],
655
- outputs=[state_seen, state_idx,
656
- image_1, image_2, image_3, image_4, image_5,
657
- status, notes_q1,
658
- score_1, score_2, score_3, score_4, score_5],
659
  )
660
- finish_event.then(
 
 
661
  to_thanks,
662
  inputs=[name, state_seen, state_samples],
663
  outputs=[eval_panel, thanks_group, thanks_md],
 
410
  gr.update(value=5), gr.update(value=5), gr.update(value=5), gr.update(value=5), gr.update(value=5),
411
  gr.update(value=None),
412
  )
413
+
414
+ def pause_exit(user_seen, samples):
415
+ return user_seen, samples
416
+
417
  def submit_next_image(
418
  name: str,
419
  email: str,
 
629
 
630
  with gr.Row():
631
  submit_next_btn = gr.Button("Submit & Next Image", variant="primary")
632
+ pause_exit_btn = gr.Button("Pause & Exit", variant="secondary")
633
 
634
  # your_jsonl_path = gr.Textbox(label="Your results file path (for reference)", interactive=False)
635
  your_jsonl_path = gr.State()
 
651
  )
652
  start_event.then(hide_thanks, inputs=None, outputs=[thanks_group])
653
 
654
+ # 1. When Pause is clicked, just pass the state through
655
+ pause_event = pause_exit_btn.click(
656
+ pause_exit,
657
+ inputs=[state_seen, state_samples],
658
+ outputs=[state_seen, state_samples],
 
 
 
659
  )
660
+
661
+ # 2. Then show the "Thanks/Resume" screen with the 'how many left' message
662
+ pause_event.then(
663
  to_thanks,
664
  inputs=[name, state_seen, state_samples],
665
  outputs=[eval_panel, thanks_group, thanks_md],