AdnanElAssadi commited on
Commit
e0f5fc6
·
verified ·
1 Parent(s): b58b8f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -27
app.py CHANGED
@@ -151,20 +151,18 @@ def create_reranking_interface(task_data):
151
  ranking_inputs = []
152
  validation_indicators = []
153
 
154
- # Add back the quick ranking tools with improved styling
155
- # Add a nicely formatted header for the ranking tools
156
- with gr.Box(elem_classes=["tool-container"]):
157
- with gr.Row(equal_height=True):
158
- with gr.Column(scale=3):
159
- gr.Markdown("### Quick Ranking Tools", elem_classes=["section-header"])
160
- with gr.Column(scale=2):
161
- sequential_btn = gr.Button("Rank in Order (1,2,3...)", variant="secondary", size="sm")
162
- with gr.Column(scale=2):
163
- reverse_btn = gr.Button("Reverse Order (n,n-1,...)", variant="secondary", size="sm")
164
- with gr.Column(scale=2):
165
- clear_btn = gr.Button("Clear All Rankings", variant="secondary", size="sm")
166
-
167
- # Adjust the document display for more reasonable textbox size
168
  with gr.Box():
169
  for i, doc in enumerate(samples[0]["candidates"]):
170
  row_class = "document-row-even" if i % 2 == 0 else "document-row-odd"
@@ -178,7 +176,7 @@ def create_reranking_interface(task_data):
178
  label=f"Document {i+1}",
179
  interactive=False,
180
  elem_classes=["document-text"],
181
- lines=4, # Reduce to 4 visible lines
182
  )
183
  doc_containers.append(doc_box)
184
 
@@ -222,24 +220,24 @@ def create_reranking_interface(task_data):
222
 
223
  .document-row {
224
  border-bottom: 1px solid #e0e0e0;
225
- padding: 12px 0;
226
- margin-bottom: 8px !important;
227
  }
228
 
229
  .document-text textarea {
230
- font-size: 16px !important;
231
- line-height: 1.6 !important;
232
- padding: 10px !important;
233
- min-height: 100px !important; /* Reduce minimum height */
234
  height: auto !important;
235
  overflow-y: visible !important;
236
  }
237
 
238
  .rank-dropdown select {
239
  font-weight: bold !important;
240
- font-size: 16px !important;
241
  text-align: center !important;
242
- padding: 8px !important;
243
  border-radius: 5px !important;
244
  border: 2px solid #2c7be5 !important;
245
  }
@@ -250,10 +248,25 @@ def create_reranking_interface(task_data):
250
  }
251
 
252
  .tool-container {
253
- margin-bottom: 20px !important;
254
  background-color: #f8f9fa !important;
255
  border-left: 4px solid #6c757d !important;
256
- padding: 10px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
 
259
  .section-header {
@@ -277,13 +290,14 @@ def create_reranking_interface(task_data):
277
  display: flex;
278
  align-items: center;
279
  justify-content: center;
280
- width: 30px;
281
- height: 30px;
282
  border-radius: 50%;
283
  background-color: #2c7be5;
284
  color: white;
285
  font-weight: bold;
286
  margin: 0 auto;
 
287
  }
288
  </style>
289
  """)
 
151
  ranking_inputs = []
152
  validation_indicators = []
153
 
154
+ # Add back the quick ranking tools with improved styling - more compact layout
155
+ with gr.Row(equal_height=True, elem_classes=["tool-row"]):
156
+ with gr.Column(scale=2):
157
+ gr.Markdown("### Quick Tools:", elem_classes=["tool-heading"])
158
+ with gr.Column(scale=2):
159
+ sequential_btn = gr.Button("1,2,3...", variant="secondary", size="sm")
160
+ with gr.Column(scale=2):
161
+ reverse_btn = gr.Button("n,n-1...", variant="secondary", size="sm")
162
+ with gr.Column(scale=2):
163
+ clear_btn = gr.Button("Clear All", variant="secondary", size="sm")
164
+
165
+ # Make document textboxes much smaller
 
 
166
  with gr.Box():
167
  for i, doc in enumerate(samples[0]["candidates"]):
168
  row_class = "document-row-even" if i % 2 == 0 else "document-row-odd"
 
176
  label=f"Document {i+1}",
177
  interactive=False,
178
  elem_classes=["document-text"],
179
+ lines=2, # Reduce to only 2 visible lines
180
  )
181
  doc_containers.append(doc_box)
182
 
 
220
 
221
  .document-row {
222
  border-bottom: 1px solid #e0e0e0;
223
+ padding: 8px 0;
224
+ margin-bottom: 4px !important;
225
  }
226
 
227
  .document-text textarea {
228
+ font-size: 14px !important;
229
+ line-height: 1.4 !important;
230
+ padding: 6px !important;
231
+ min-height: 60px !important; /* Dramatically reduce minimum height */
232
  height: auto !important;
233
  overflow-y: visible !important;
234
  }
235
 
236
  .rank-dropdown select {
237
  font-weight: bold !important;
238
+ font-size: 14px !important;
239
  text-align: center !important;
240
+ padding: 5px !important;
241
  border-radius: 5px !important;
242
  border: 2px solid #2c7be5 !important;
243
  }
 
248
  }
249
 
250
  .tool-container {
251
+ margin-bottom: 10px !important;
252
  background-color: #f8f9fa !important;
253
  border-left: 4px solid #6c757d !important;
254
+ padding: 5px !important;
255
+ }
256
+
257
+ .tool-row {
258
+ background-color: #f0f0f0 !important;
259
+ border-radius: 5px !important;
260
+ padding: 5px !important;
261
+ margin-bottom: 10px !important;
262
+ align-items: center !important;
263
+ }
264
+
265
+ .tool-heading {
266
+ margin: 0 !important;
267
+ padding-top: 5px !important;
268
+ font-size: 16px !important;
269
+ font-weight: bold !important;
270
  }
271
 
272
  .section-header {
 
290
  display: flex;
291
  align-items: center;
292
  justify-content: center;
293
+ width: 25px;
294
+ height: 25px;
295
  border-radius: 50%;
296
  background-color: #2c7be5;
297
  color: white;
298
  font-weight: bold;
299
  margin: 0 auto;
300
+ font-size: 12px !important;
301
  }
302
  </style>
303
  """)