akaburia commited on
Commit
5e365bb
·
verified ·
1 Parent(s): 9c8b254

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -15
app.py CHANGED
@@ -490,14 +490,16 @@ custom_css = """
490
  overflow-y: auto !important;
491
  }
492
 
493
- /* --- NEW: CONSTRAINED SCROLL VIEW --- */
494
- /* Instead of making the header sticky, we make the row area scrollable internally */
495
- .scroll-container {
496
- max-height: 50vh !important; /* Forces the scrolling to happen INSIDE this box */
497
- overflow-y: auto !important;
498
- padding-right: 10px !important;
499
- border-top: 2px solid #e5e7eb !important;
500
- padding-top: 15px !important;
 
 
501
  }
502
  """
503
 
@@ -621,7 +623,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
621
 
622
  with gr.Group(visible=False) as workspace_box:
623
 
624
- # --- Reference Header (No special classes needed) ---
 
625
  with gr.Row():
626
  with gr.Column(scale=1, variant="panel"):
627
  meta_a = gr.Markdown("### Source A Information")
@@ -632,9 +635,9 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
632
  meta_b = gr.Markdown("### Source B Information")
633
  display_context_b = gr.Textbox(label="Context B", interactive=False, lines=4)
634
 
635
- # --- Target B Rows (Constrained Scroll Container) ---
636
- # We apply the class here so ONLY the rows scroll, leaving the header firmly above.
637
- with gr.Group(elem_classes="scroll-container"):
638
  bulk_title = gr.Markdown("### Bulk Coherence Evaluation")
639
  bulk_desc = gr.Markdown(
640
  "Evaluate how the **Target A** above interacts with the **Target B** statements below.\n"
@@ -646,6 +649,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
646
  eval_rows = []
647
  for i in range(MAX_ROWS):
648
  with gr.Group(visible=False) as row_container:
 
649
  m_coarse_st = gr.State("")
650
  m_drill_st = gr.State("")
651
  m_conf_st = gr.State("")
@@ -653,7 +657,13 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
653
  m_ig_json_st = gr.State("")
654
 
655
  with gr.Row(equal_height=True):
656
- b_text = gr.Textbox(label=f"Target B", interactive=False, scale=4, min_width=200, elem_classes="scrollable-target")
 
 
 
 
 
 
657
  rel_radio = gr.Radio(choices=["coherent", "neutral", "incoherent"], label="1. Class", scale=2, min_width=120)
658
 
659
  with gr.Column(scale=1):
@@ -678,10 +688,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo:
678
  inputs=None,
679
  outputs=[rel_radio, inter_dd, just_box]
680
  )
681
-
682
  eval_rows.append((row_container, b_text, rel_radio, conf_md, inter_dd, just_box, m_coarse_st, m_drill_st, m_conf_st, m_ai_just_st, m_ig_json_st))
683
 
684
- # --- Action Buttons stay fixed below the scroll container ---
 
685
  with gr.Row():
686
  prev_btn = gr.Button("⬅️ Previous Target A", size="lg")
687
  skip_btn = gr.Button("Skip Target A", size="lg")
 
490
  overflow-y: auto !important;
491
  }
492
 
493
+ /* --- ROBUST SCROLLING CONTAINER --- */
494
+ /* Instead of making the header sticky, we make the bottom section scrollable */
495
+ .scrollable-rows-container {
496
+ max-height: 60vh !important; /* Forces the area to be 60% of the screen height */
497
+ overflow-y: auto !important; /* Adds a scrollbar only to the rows */
498
+ padding-right: 15px !important;
499
+ border: 2px solid #e5e7eb !important;
500
+ border-radius: 8px !important;
501
+ background-color: #f9fafb !important;
502
+ margin-top: 15px !important;
503
  }
504
  """
505
 
 
623
 
624
  with gr.Group(visible=False) as workspace_box:
625
 
626
+ # --- THE FIXED HEADER ---
627
+ # This stays naturally at the top of the workspace
628
  with gr.Row():
629
  with gr.Column(scale=1, variant="panel"):
630
  meta_a = gr.Markdown("### Source A Information")
 
635
  meta_b = gr.Markdown("### Source B Information")
636
  display_context_b = gr.Textbox(label="Context B", interactive=False, lines=4)
637
 
638
+ # --- THE SCROLLABLE ROWS ---
639
+ # We wrap everything else in the new constrained box
640
+ with gr.Group(elem_classes="scrollable-rows-container"):
641
  bulk_title = gr.Markdown("### Bulk Coherence Evaluation")
642
  bulk_desc = gr.Markdown(
643
  "Evaluate how the **Target A** above interacts with the **Target B** statements below.\n"
 
649
  eval_rows = []
650
  for i in range(MAX_ROWS):
651
  with gr.Group(visible=False) as row_container:
652
+ # 3 Hidden states per row to lock in the Model's independent predictions
653
  m_coarse_st = gr.State("")
654
  m_drill_st = gr.State("")
655
  m_conf_st = gr.State("")
 
657
  m_ig_json_st = gr.State("")
658
 
659
  with gr.Row(equal_height=True):
660
+ b_text = gr.Textbox(
661
+ label=f"Target B",
662
+ interactive=False,
663
+ scale=4,
664
+ min_width=200,
665
+ elem_classes="scrollable-target"
666
+ )
667
  rel_radio = gr.Radio(choices=["coherent", "neutral", "incoherent"], label="1. Class", scale=2, min_width=120)
668
 
669
  with gr.Column(scale=1):
 
688
  inputs=None,
689
  outputs=[rel_radio, inter_dd, just_box]
690
  )
691
+
692
  eval_rows.append((row_container, b_text, rel_radio, conf_md, inter_dd, just_box, m_coarse_st, m_drill_st, m_conf_st, m_ai_just_st, m_ig_json_st))
693
 
694
+ # --- NAVIGATION BUTTONS ---
695
+ # Kept outside the scrollable box so they are always visible at the very bottom
696
  with gr.Row():
697
  prev_btn = gr.Button("⬅️ Previous Target A", size="lg")
698
  skip_btn = gr.Button("Skip Target A", size="lg")