QIDNLF commited on
Commit
36eb37f
·
verified ·
1 Parent(s): 52f2903

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -30
app.py CHANGED
@@ -353,47 +353,62 @@ with gr.Blocks() as demo:
353
  comp_reset_btn.click(reset_comp, None, [comp_standard, comp_version, comp_category])
354
 
355
  # --------------------------
356
- # CSS (이미지 포함 개선)
357
  # --------------------------
358
- css = """ table { table-layout: fixed !important; width: 100% !important; }
359
- --------------------------
360
- 2컬럼 (단일 조회)
361
- --------------------------
362
- table th:nth-last-child(2):first-child,table td:nth-last-child(2):first-child { width: 15% !important; }
363
- table th:nth-last-child(1),table td:nth-last-child(1) { width: 85% !important; }
364
- --------------------------
365
- 4컬럼 (비교)
366
- --------------------------
367
- table th:nth-child(1):nth-last-child(4),table td:nth-child(1):nth-last-child(4) { width: 7% !important; }
368
- table th:nth-child(2):nth-last-child(3),table td:nth-child(2):nth-last-child(3) { width: 43% !important; }
369
- table th:nth-child(3):nth-last-child(2),table td:nth-child(3):nth-last-child(2) { width: 7% !important; }
370
- table th:nth-child(4):nth-last-child(1),table td:nth-child(4):nth-last-child(1) { width: 43% !important; }
371
- --------------------------
372
- 6컬럼 (TableA)
373
- --------------------------
374
- table th:nth-child(1):nth-last-child(6),table td:nth-child(1):nth-last-child(6) { width: 8% !important; }
375
- table th:nth-child(2):nth-last-child(5),table td:nth-child(2):nth-last-child(5) { width: 25% !important; }
376
- table th:nth-child(3):nth-last-child(4),table td:nth-child(3):nth-last-child(4) { width: 8% !important; }
377
- table th:nth-child(4):nth-last-child(3),table td:nth-child(4):nth-last-child(3) { width: 25% !important; }
378
- table th:nth-child(5):nth-last-child(2),table td:nth-child(5):nth-last-child(2) { width: 8% !important; }
379
- table th:nth-child(6):nth-last-child(1),table td:nth-child(6):nth-last-child(1) { width: 26% !important; }
380
-
381
- --------------------------
 
 
 
 
 
 
 
 
 
382
  thead th {
383
  position: sticky;
384
  top: 0;
385
- background: white; }
 
 
386
  .dataframe {
387
  max-height: none !important;
388
- overflow-y: visible !important; }
 
389
  .dataframe > div {
390
  max-height: none !important;
391
- overflow: visible !important; }
 
392
  td {
393
  white-space: normal !important;
394
  word-break: break-word !important;
395
- line-height: 1.6; padding: 10px; }
396
- """
 
 
397
  if __name__ == "__main__":
398
  demo.launch(
399
  theme=gr.themes.Soft(),
 
353
  comp_reset_btn.click(reset_comp, None, [comp_standard, comp_version, comp_category])
354
 
355
  # --------------------------
356
+ # CSS (이미지 포함 및 동적 컬럼 너비 개선)
357
  # --------------------------
358
+ css = """
359
+ table {
360
+ table-layout: fixed !important;
361
+ width: 100% !important;
362
+ }
363
+
364
+ /* -------------------------- */
365
+ /* 2컬럼 (단일 조회) */
366
+ /* -------------------------- */
367
+ table th:nth-last-child(2):first-child, table td:nth-last-child(2):first-child { width: 15% !important; }
368
+ table th:nth-last-child(1), table td:nth-last-child(1) { width: 85% !important; }
369
+
370
+ /* -------------------------- */
371
+ /* 4컬럼 (비교) */
372
+ /* -------------------------- */
373
+ table th:nth-child(1):nth-last-child(4), table td:nth-child(1):nth-last-child(4) { width: 7% !important; }
374
+ table th:nth-child(2):nth-last-child(3), table td:nth-child(2):nth-last-child(3) { width: 43% !important; }
375
+ table th:nth-child(3):nth-last-child(2), table td:nth-child(3):nth-last-child(2) { width: 7% !important; }
376
+ table th:nth-child(4):nth-last-child(1), table td:nth-child(4):nth-last-child(1) { width: 43% !important; }
377
+
378
+ /* -------------------------- */
379
+ /* 6컬럼 (TableA 등) */
380
+ /* -------------------------- */
381
+ table th:nth-child(1):nth-last-child(6), table td:nth-child(1):nth-last-child(6) { width: 8% !important; }
382
+ table th:nth-child(2):nth-last-child(5), table td:nth-child(2):nth-last-child(5) { width: 25% !important; }
383
+ table th:nth-child(3):nth-last-child(4), table td:nth-child(3):nth-last-child(4) { width: 8% !important; }
384
+ table th:nth-child(4):nth-last-child(3), table td:nth-child(4):nth-last-child(3) { width: 25% !important; }
385
+ table th:nth-child(5):nth-last-child(2), table td:nth-child(5):nth-last-child(2) { width: 8% !important; }
386
+ table th:nth-child(6):nth-last-child(1), table td:nth-child(6):nth-last-child(1) { width: 26% !important; }
387
+
388
+ /* -------------------------- */
389
+ /* 기본 테이블 스타일 */
390
+ /* -------------------------- */
391
  thead th {
392
  position: sticky;
393
  top: 0;
394
+ background: white;
395
+ z-index: 10; /* 스크롤 시 텍스트 겹침 방지 */
396
+ }
397
  .dataframe {
398
  max-height: none !important;
399
+ overflow-y: visible !important;
400
+ }
401
  .dataframe > div {
402
  max-height: none !important;
403
+ overflow: visible !important;
404
+ }
405
  td {
406
  white-space: normal !important;
407
  word-break: break-word !important;
408
+ line-height: 1.6;
409
+ padding: 10px;
410
+ }
411
+ """
412
  if __name__ == "__main__":
413
  demo.launch(
414
  theme=gr.themes.Soft(),