DontPlanToEnd commited on
Commit
8802c2f
·
verified ·
1 Parent(s): 761f7f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -7
app.py CHANGED
@@ -203,6 +203,17 @@ app.index_string = '''
203
  text-align: left !important;
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
206
  .wrap-text {
207
  white-space: normal !important;
208
  line-height: 1.2em;
@@ -324,6 +335,16 @@ app.index_string = '''
324
  .markdown-content a:visited {
325
  color: var(--link-color) !important;
326
  }
 
 
 
 
 
 
 
 
 
 
327
  </style>
328
  </head>
329
  <body>
@@ -512,8 +533,47 @@ for i, col in enumerate(AXES_COLS_1):
512
  else: # Middle columns
513
  col_def["cellClass"] = ["ag-left-aligned-cell"]
514
  columnDefs.append(col_def)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  for col in AXES_COLS_2:
516
- columnDefs.append(create_numeric_column(col, width=175)) # Wider
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
 
518
  # Date Columns
519
  columnDefs.extend([
@@ -768,12 +828,6 @@ app.layout = html.Div([
768
  html.Li("Scty: Higher = Progressive values, Lower = Traditional values")
769
  ], style={'marginTop': '0px', 'marginBottom': '16px'}),
770
 
771
- html.P([
772
- "For the 12 political axes, the percentage shown is how much the model aligns with the trait on the ",
773
- html.U("left side of the hyphen"),
774
- "."
775
- ]),
776
-
777
  html.Br(),
778
 
779
  html.P("All local models are tested using Q6_K.gguf quants.")
 
203
  text-align: left !important;
204
  }
205
 
206
+ .ag-header-cell-text {
207
+ white-space: normal !important;
208
+ line-height: 1.2em;
209
+ overflow: visible;
210
+ }
211
+
212
+ .ag-header-cell {
213
+ height: auto !important;
214
+ min-height: 48px;
215
+ }
216
+
217
  .wrap-text {
218
  white-space: normal !important;
219
  line-height: 1.2em;
 
335
  .markdown-content a:visited {
336
  color: var(--link-color) !important;
337
  }
338
+
339
+ .split-header-container {
340
+ display: flex;
341
+ flex-direction: column;
342
+ line-height: 1.2em;
343
+ }
344
+
345
+ .split-header-top, .split-header-bottom {
346
+ white-space: nowrap;
347
+ }
348
  </style>
349
  </head>
350
  <body>
 
533
  else: # Middle columns
534
  col_def["cellClass"] = ["ag-left-aligned-cell"]
535
  columnDefs.append(col_def)
536
+ template_with_split_header = """
537
+ <div class="ag-cell-label-container" role="presentation">
538
+ <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button"></span>
539
+ <div ref="eLabel" class="ag-header-cell-label" role="presentation">
540
+ <div class="split-header-container">
541
+ <div class="split-header-top">↑ {high}</div>
542
+ <div class="split-header-bottom">↓ {low}</div>
543
+ </div>
544
+ <span ref="eText" class="ag-header-cell-text" style="display: none"></span>
545
+ <span ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>
546
+ <span ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>
547
+ <span ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>
548
+ <span ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>
549
+ <span ref="eFilter" class="ag-header-icon ag-filter-icon"></span>
550
+ </div>
551
+ </div>
552
+ """
553
+
554
  for col in AXES_COLS_2:
555
+ high, low = col.split('-')
556
+ columnDefs.append({
557
+ "field": col,
558
+ "headerComponentParams": {
559
+ "template": template_with_split_header.format(high=high, low=low)
560
+ },
561
+ "width": 175,
562
+ "sortable": True,
563
+ "filter": "agNumberColumnFilter",
564
+ "filterParams": {
565
+ "defaultOption": "inRange",
566
+ "filterOptions": ['equals', 'notEqual', 'greaterThan', 'greaterThanOrEqual', 'lessThan', 'lessThanOrEqual', 'inRange']
567
+ },
568
+ "valueFormatter": {
569
+ "function": """
570
+ function(params) {
571
+ if (params.value === null || params.value === undefined) return '';
572
+ return d3.format('.1f')(params.value) + '%';
573
+ }
574
+ """
575
+ }
576
+ })
577
 
578
  # Date Columns
579
  columnDefs.extend([
 
828
  html.Li("Scty: Higher = Progressive values, Lower = Traditional values")
829
  ], style={'marginTop': '0px', 'marginBottom': '16px'}),
830
 
 
 
 
 
 
 
831
  html.Br(),
832
 
833
  html.P("All local models are tested using Q6_K.gguf quants.")