forouzanfallah commited on
Commit
453f64d
·
verified ·
1 Parent(s): f76dc8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -538,13 +538,14 @@ def to_thanks(name: str, user_seen: List[str], samples: List[Sample]):
538
  def hide_thanks():
539
  return gr.update(visible=False)
540
 
541
- def maybe_show_thanks(name: str, seen: List[str]):
542
- done = len(set(seen or [])) >= TARGET_PER_PERSON
543
- if done:
544
- return to_thanks(name)
545
- return gr.update(), gr.update(visible=False), gr.update()
546
-
547
- # --- NEW FUNCTION: Reset to First Page ---
 
548
  def reset_to_start():
549
  """
550
  Clears inputs and resets the view to the login page.
@@ -696,7 +697,7 @@ with gr.Blocks(title="RTS Human Evaluation", theme=gr.themes.Soft()) as demo:
696
  )
697
  nextimg_event.then(
698
  maybe_show_thanks,
699
- inputs=[name, state_seen],
700
  outputs=[eval_panel, thanks_group, thanks_md],
701
  )
702
 
 
538
  def hide_thanks():
539
  return gr.update(visible=False)
540
 
541
+ def maybe_show_thanks(name: str, seen: List[str], samples: List[Sample]):
542
+ # Check if the user has reached the target
543
+ if len(set(seen or [])) >= TARGET_PER_PERSON:
544
+ return to_thanks(name, seen, samples)
545
+
546
+ # If not done, keep evaluation panel visible
547
+ return gr.update(visible=True), gr.update(visible=False), gr.update()
548
+
549
  def reset_to_start():
550
  """
551
  Clears inputs and resets the view to the login page.
 
697
  )
698
  nextimg_event.then(
699
  maybe_show_thanks,
700
+ inputs=[name, state_seen, state_samples],
701
  outputs=[eval_panel, thanks_group, thanks_md],
702
  )
703