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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -10
app.py CHANGED
@@ -486,15 +486,30 @@ def submit_next_image(
486
  )
487
 
488
 
489
- def to_thanks(name: str):
490
- msg = (
491
- f"### Thanks, {name}! Your responses were saved.\n\n"
492
- f"We’re grateful for your time and expertise. Our suggested target is "
493
- f"{TARGET_PER_PERSON} images per reviewer, but you’re welcome to continue — "
494
- f"we have more images available.\n\n"
495
- f"If you have questions, issues, or suggestions, please email **{CONTACT_EMAIL}**.\n\n"
496
- f"Click **Start Again** to evaluate another image."
497
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  return gr.update(visible=False), gr.update(visible=True), gr.update(value=msg)
499
 
500
  def hide_thanks():
@@ -644,7 +659,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
644
  )
645
  finish_event.then(
646
  to_thanks,
647
- inputs=[name],
648
  outputs=[eval_panel, thanks_group, thanks_md],
649
  )
650
 
 
486
  )
487
 
488
 
489
+ def to_thanks(name: str, user_seen: List[str], samples: List[Sample]):
490
+ # Calculate how many are left based on the updated seen list
491
+ left = user_left_count(user_seen, samples)
492
+ target = user_target_count(samples)
493
+ if left > 0:
494
+ # Message for users who are leaving early
495
+ msg = (
496
+ f"### ⏸️ Session Paused!\n\n"
497
+ f"### ✅ Thanks, {name}! Your progress has been saved.\n\n"
498
+ f"We’re grateful for your time and expertise. Our suggested target is "
499
+ f"{TARGET_PER_PERSON} images per reviewer"
500
+ f"You have **{left}** images left.\n\n"
501
+ f"You can close this tab and return whenever you like—just use the same Name and Email to **continue where you left off**.\n\n"
502
+ f"If you have questions, issues, or suggestions, please email **{CONTACT_EMAIL}**.\n\n"
503
+ f"Click **Start Again** to evaluate another image."
504
+ )
505
+ else:
506
+ # Message for users who completed the target
507
+ msg = (
508
+ f"### ✅ All Done, {name}!\n\n"
509
+ f"You’ve completed the target of **{target}** images. Your responses are securely saved.\n\n"
510
+ f"We’re extremely grateful for your time and expertise. You are welcome to continue with more images if you wish, or you can finish here.\n\n"
511
+ f"If you have questions, issues, or suggestions, please email **{CONTACT_EMAIL}**.\n\n"
512
+ )
513
  return gr.update(visible=False), gr.update(visible=True), gr.update(value=msg)
514
 
515
  def hide_thanks():
 
659
  )
660
  finish_event.then(
661
  to_thanks,
662
+ inputs=[name, state_seen, state_samples],
663
  outputs=[eval_panel, thanks_group, thanks_md],
664
  )
665