AdnanElAssadi commited on
Commit
ba20f39
·
verified ·
1 Parent(s): 02e7c1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -32
app.py CHANGED
@@ -100,8 +100,7 @@ def create_reranking_interface(task_data):
100
  1. Read the query at the top
101
  2. Review each document carefully
102
  3. Assign a rank to each document (1 = most relevant, higher numbers = less relevant)
103
- - Use the rank buttons for quick ranking
104
- - Or use the dropdown menus for more options
105
  4. Each document must have a unique rank
106
  5. Click "Submit Rankings" to save rankings for the current query
107
  6. Use "Previous" and "Next" to navigate between queries
@@ -167,7 +166,7 @@ def create_reranking_interface(task_data):
167
  with gr.Column(scale=1, min_width=50):
168
  gr.HTML(f"<div class='doc-number'>{i+1}</div>")
169
 
170
- with gr.Column(scale=6):
171
  doc_box = gr.Textbox(
172
  value=doc,
173
  label=f"Document {i+1}",
@@ -176,15 +175,6 @@ def create_reranking_interface(task_data):
176
  )
177
  doc_containers.append(doc_box)
178
 
179
- # Add rank buttons for quick ranking
180
- with gr.Column(scale=2):
181
- # Create row of quick buttons for ranks 1-5
182
- rank_buttons = []
183
- with gr.Row():
184
- for rank in range(1, min(6, len(samples[0]["candidates"])+1)):
185
- btn = gr.Button(f"{rank}", size="sm")
186
- rank_buttons.append((btn, rank))
187
-
188
  with gr.Column(scale=2):
189
  # Dropdown for ranking
190
  rank_input = gr.Dropdown(
@@ -651,26 +641,6 @@ def create_reranking_interface(task_data):
651
 
652
  return [result]
653
 
654
- # Connect rank buttons to their corresponding documents
655
- for i, doc_rank_input in enumerate(ranking_inputs):
656
- # Get the buttons for this row
657
- row_buttons = rank_buttons[i*5:(i+1)*5] if i*5 < len(rank_buttons) else []
658
- for btn, rank in row_buttons:
659
- # Create a function to set this specific rank
660
- def set_rank(rank_value=rank, doc_index=i):
661
- def set_this_rank():
662
- result = [""] * len(ranking_inputs)
663
- result[doc_index] = str(rank_value)
664
- return result
665
- return set_this_rank
666
-
667
- # Connect button to ranking input
668
- btn.click(
669
- fn=set_rank(),
670
- inputs=None,
671
- outputs=[doc_rank_input]
672
- )
673
-
674
  return demo
675
 
676
  # Main app with file upload capability and improved task management
 
100
  1. Read the query at the top
101
  2. Review each document carefully
102
  3. Assign a rank to each document (1 = most relevant, higher numbers = less relevant)
103
+ - Use the dropdown menus to select ranks
 
104
  4. Each document must have a unique rank
105
  5. Click "Submit Rankings" to save rankings for the current query
106
  6. Use "Previous" and "Next" to navigate between queries
 
166
  with gr.Column(scale=1, min_width=50):
167
  gr.HTML(f"<div class='doc-number'>{i+1}</div>")
168
 
169
+ with gr.Column(scale=7):
170
  doc_box = gr.Textbox(
171
  value=doc,
172
  label=f"Document {i+1}",
 
175
  )
176
  doc_containers.append(doc_box)
177
 
 
 
 
 
 
 
 
 
 
178
  with gr.Column(scale=2):
179
  # Dropdown for ranking
180
  rank_input = gr.Dropdown(
 
641
 
642
  return [result]
643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
  return demo
645
 
646
  # Main app with file upload capability and improved task management