Update app.py
Browse files
app.py
CHANGED
|
@@ -508,16 +508,16 @@ def execute_unified_search(base_std, base_ver, base_cat, comp_std, comp_ver, com
|
|
| 508 |
js_resizable = """
|
| 509 |
function() {
|
| 510 |
const attachResizers = () => {
|
| 511 |
-
|
| 512 |
-
const tables = document.querySelectorAll('table');
|
| 513 |
if (tables.length === 0) return;
|
| 514 |
|
| 515 |
tables.forEach(table => {
|
| 516 |
-
// ์ด๋ฏธ ํธ๋ค์ด ๋ถ์๋์ง ์ฒดํฌ
|
| 517 |
if (table.dataset.resizable === 'true') return;
|
| 518 |
|
|
|
|
| 519 |
table.style.tableLayout = 'fixed';
|
| 520 |
-
table.style.width = '
|
|
|
|
| 521 |
|
| 522 |
const headers = table.querySelectorAll('th');
|
| 523 |
headers.forEach(th => {
|
|
@@ -530,32 +530,40 @@ function() {
|
|
| 530 |
|
| 531 |
let startX, startWidth;
|
| 532 |
|
| 533 |
-
|
| 534 |
startX = e.pageX;
|
| 535 |
startWidth = th.offsetWidth;
|
| 536 |
document.addEventListener('mousemove', onMouseMove);
|
| 537 |
document.addEventListener('mouseup', onMouseUp);
|
| 538 |
-
|
|
|
|
|
|
|
| 539 |
e.preventDefault();
|
| 540 |
-
}
|
| 541 |
|
| 542 |
function onMouseMove(e) {
|
| 543 |
-
|
|
|
|
|
|
|
|
|
|
| 544 |
th.style.width = width + 'px';
|
| 545 |
th.style.minWidth = width + 'px';
|
|
|
|
| 546 |
}
|
| 547 |
|
| 548 |
function onMouseUp() {
|
| 549 |
document.removeEventListener('mousemove', onMouseMove);
|
| 550 |
document.removeEventListener('mouseup', onMouseUp);
|
| 551 |
-
resizer.style.backgroundColor = '
|
|
|
|
| 552 |
}
|
|
|
|
|
|
|
| 553 |
});
|
| 554 |
table.dataset.resizable = 'true';
|
| 555 |
});
|
| 556 |
};
|
| 557 |
|
| 558 |
-
// 0.2์ด ๊ฐ๊ฒฉ์ผ๋ก ์ต๋ 5์ด๊ฐ ํ๊ฐ ๋ํ๋๋์ง ๊ฐ์
|
| 559 |
let attempts = 0;
|
| 560 |
const interval = setInterval(() => {
|
| 561 |
attachResizers();
|
|
@@ -611,49 +619,20 @@ with gr.Blocks() as demo:
|
|
| 611 |
comp_reset_btn.click(fn=reset_comp_selections, inputs=None, outputs=[comp_standard, comp_version, comp_category])
|
| 612 |
|
| 613 |
|
|
|
|
|
|
|
|
|
|
| 614 |
# ==========================================
|
| 615 |
# 5. Application Styling (CSS)
|
| 616 |
# ==========================================
|
| 617 |
css = """
|
|
|
|
| 618 |
table {
|
| 619 |
-
table-layout: auto !important;
|
| 620 |
-
width: max-content !important;
|
| 621 |
-
min-width: 100% !important;
|
| 622 |
-
}
|
| 623 |
-
|
| 624 |
-
th, td {
|
| 625 |
-
min-width: 150px;
|
| 626 |
-
}
|
| 627 |
-
|
| 628 |
-
table:has(th:nth-last-child(2):first-child),
|
| 629 |
-
table:has(th:nth-last-child(4):first-child),
|
| 630 |
-
table:has(th:nth-last-child(5):first-child),
|
| 631 |
-
table:has(th:nth-last-child(6):first-child) {
|
| 632 |
-
table-layout: fixed !important;
|
| 633 |
width: 100% !important;
|
|
|
|
| 634 |
}
|
| 635 |
|
| 636 |
-
|
| 637 |
-
table th:nth-last-child(1), table td:nth-last-child(1) { width: 85% !important; min-width: 0 !important; }
|
| 638 |
-
|
| 639 |
-
table th:nth-child(1):nth-last-child(4), table td:nth-child(1):nth-last-child(4) { width: 10% !important; min-width: 0 !important; }
|
| 640 |
-
table th:nth-child(2):nth-last-child(3), table td:nth-child(2):nth-last-child(3) { width: 40% !important; min-width: 0 !important; }
|
| 641 |
-
table th:nth-child(3):nth-last-child(2), table td:nth-child(3):nth-last-child(2) { width: 10% !important; min-width: 0 !important; }
|
| 642 |
-
table th:nth-child(4):nth-last-child(1), table td:nth-child(4):nth-last-child(1) { width: 40% !important; min-width: 0 !important; }
|
| 643 |
-
|
| 644 |
-
table th:nth-child(1):nth-last-child(5), table td:nth-child(1):nth-last-child(5) { width: 15% !important; min-width: 0 !important; }
|
| 645 |
-
table th:nth-child(2):nth-last-child(4), table td:nth-child(2):nth-last-child(4) { width: 10% !important; min-width: 0 !important; }
|
| 646 |
-
table th:nth-child(3):nth-last-child(3), table td:nth-child(3):nth-last-child(3) { width: 30% !important; min-width: 0 !important; }
|
| 647 |
-
table th:nth-child(4):nth-last-child(2), table td:nth-child(4):nth-last-child(2) { width: 10% !important; min-width: 0 !important; }
|
| 648 |
-
table th:nth-child(5):nth-last-child(1), table td:nth-child(5):nth-last-child(1) { width: 35% !important; min-width: 0 !important; }
|
| 649 |
-
|
| 650 |
-
table th:nth-child(1):nth-last-child(6), table td:nth-child(1):nth-last-child(6) { width: 8% !important; min-width: 0 !important; }
|
| 651 |
-
table th:nth-child(2):nth-last-child(5), table td:nth-child(2):nth-last-child(5) { width: 15% !important; min-width: 0 !important; }
|
| 652 |
-
table th:nth-child(3):nth-last-child(4), table td:nth-child(3):nth-last-child(4) { width: 27% !important; min-width: 0 !important; }
|
| 653 |
-
table th:nth-child(4):nth-last-child(3), table td:nth-child(4):nth-last-child(3) { width: 8% !important; min-width: 0 !important; }
|
| 654 |
-
table th:nth-child(5):nth-last-child(2), table td:nth-child(5):nth-last-child(2) { width: 15% !important; min-width: 0 !important; }
|
| 655 |
-
table th:nth-child(6):nth-last-child(1), table td:nth-child(6):nth-last-child(1) { width: 27% !important; min-width: 0 !important; }
|
| 656 |
-
|
| 657 |
thead th {
|
| 658 |
font-size: 18px !important;
|
| 659 |
position: sticky;
|
|
@@ -661,20 +640,10 @@ thead th {
|
|
| 661 |
background: white;
|
| 662 |
z-index: 10;
|
| 663 |
}
|
| 664 |
-
|
| 665 |
-
max-height: none !important;
|
| 666 |
-
overflow-y: visible !important;
|
| 667 |
-
overflow-x: auto !important;
|
| 668 |
-
display: block;
|
| 669 |
-
}
|
| 670 |
-
.dataframe > div {
|
| 671 |
-
max-height: none !important;
|
| 672 |
-
overflow: visible !important;
|
| 673 |
-
}
|
| 674 |
-
td {
|
| 675 |
font-size: 18px !important;
|
| 676 |
-
|
| 677 |
-
|
| 678 |
line-height: 1.6;
|
| 679 |
padding: 10px;
|
| 680 |
vertical-align: top !important;
|
|
@@ -684,22 +653,8 @@ td img {
|
|
| 684 |
display: block;
|
| 685 |
max-width: none !important;
|
| 686 |
}
|
| 687 |
-
/* 5๋ฒ ๊ตฌ์ญ CSS์ ์ถ๊ฐ */
|
| 688 |
-
.dataframe th {
|
| 689 |
-
position: relative !important;
|
| 690 |
-
overflow: visible !important; /* ์ด๊ฒ ์์ผ๋ฉด ํธ๋ค์ด ์ ๋ณด์
๋๋ค */
|
| 691 |
-
}
|
| 692 |
|
| 693 |
-
/*
|
| 694 |
-
.resizer {
|
| 695 |
-
background-color: transparent; /* ํ์์ ํฌ๋ช
*/
|
| 696 |
-
transition: background-color 0.2s;
|
| 697 |
-
}
|
| 698 |
-
|
| 699 |
-
.resizer:hover, .resizer.resizing {
|
| 700 |
-
background-color: #1a73e8 !important; /* ๋ง์ฐ์ค ์ฌ๋ฆฌ๋ฉด ํ๋์ ์ ์ด ๋ธ */
|
| 701 |
-
width: 4px !important;
|
| 702 |
-
}
|
| 703 |
.gradio-container .dataframe,
|
| 704 |
.gradio-container .dataframe div,
|
| 705 |
.gradio-container thead,
|
|
@@ -707,22 +662,56 @@ td img {
|
|
| 707 |
.gradio-container th {
|
| 708 |
overflow: visible !important;
|
| 709 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
|
| 711 |
-
/* ํธ๋ค(Resizer)
|
| 712 |
.resizer {
|
| 713 |
-
background-color: rgba(255, 0, 0, 0.5); /*
|
| 714 |
-
width:
|
| 715 |
height: 100%;
|
| 716 |
position: absolute;
|
| 717 |
right: 0;
|
| 718 |
top: 0;
|
| 719 |
cursor: col-resize;
|
| 720 |
-
z-index: 9999 !important;
|
|
|
|
|
|
|
|
|
|
| 721 |
}
|
| 722 |
|
| 723 |
-
.
|
| 724 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 725 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
"""
|
| 727 |
|
| 728 |
if __name__ == "__main__":
|
|
|
|
| 508 |
js_resizable = """
|
| 509 |
function() {
|
| 510 |
const attachResizers = () => {
|
| 511 |
+
const tables = document.querySelectorAll('.dataframe table');
|
|
|
|
| 512 |
if (tables.length === 0) return;
|
| 513 |
|
| 514 |
tables.forEach(table => {
|
|
|
|
| 515 |
if (table.dataset.resizable === 'true') return;
|
| 516 |
|
| 517 |
+
// [ํต์ฌ] ํ๊ฐ ํ๋ฉด ๋ฐ์ผ๋ก ์์ ๋กญ๊ฒ ๋์ด๋ ์ ์๋๋ก ์กฑ์ ํด์
|
| 518 |
table.style.tableLayout = 'fixed';
|
| 519 |
+
table.style.width = 'max-content';
|
| 520 |
+
table.style.minWidth = '100%';
|
| 521 |
|
| 522 |
const headers = table.querySelectorAll('th');
|
| 523 |
headers.forEach(th => {
|
|
|
|
| 530 |
|
| 531 |
let startX, startWidth;
|
| 532 |
|
| 533 |
+
function onMouseDown(e) {
|
| 534 |
startX = e.pageX;
|
| 535 |
startWidth = th.offsetWidth;
|
| 536 |
document.addEventListener('mousemove', onMouseMove);
|
| 537 |
document.addEventListener('mouseup', onMouseUp);
|
| 538 |
+
|
| 539 |
+
resizer.style.backgroundColor = '#1a73e8'; // ๋๋๊ทธ ์ค ํ๋์
|
| 540 |
+
document.body.style.userSelect = 'none'; // ๋๋๊ทธ ์ค ๊ธ์ ๋๋๊ทธ ๋ฐฉ์ง (๋ถ๋๋ฌ์ด ์กฐ์๊ฐ)
|
| 541 |
e.preventDefault();
|
| 542 |
+
}
|
| 543 |
|
| 544 |
function onMouseMove(e) {
|
| 545 |
+
// ๋๋น ๊ฐ์ ๊ณ์ฐ (์ต์ 50px ๋ณด์ฅ)
|
| 546 |
+
const width = Math.max(50, startWidth + (e.pageX - startX));
|
| 547 |
+
|
| 548 |
+
// 3์ค ๊ฐ์ ํ ๋น์ผ๋ก CSS๋ฅผ ์๋ฒฝํ๊ฒ ๋ฎ์ด์์
|
| 549 |
th.style.width = width + 'px';
|
| 550 |
th.style.minWidth = width + 'px';
|
| 551 |
+
th.style.maxWidth = width + 'px';
|
| 552 |
}
|
| 553 |
|
| 554 |
function onMouseUp() {
|
| 555 |
document.removeEventListener('mousemove', onMouseMove);
|
| 556 |
document.removeEventListener('mouseup', onMouseUp);
|
| 557 |
+
resizer.style.backgroundColor = 'rgba(255, 0, 0, 0.5)'; // ๋ค์ ๋นจ๊ฐ์์ผ๋ก ๋ณต๊ท
|
| 558 |
+
document.body.style.userSelect = '';
|
| 559 |
}
|
| 560 |
+
|
| 561 |
+
resizer.addEventListener('mousedown', onMouseDown);
|
| 562 |
});
|
| 563 |
table.dataset.resizable = 'true';
|
| 564 |
});
|
| 565 |
};
|
| 566 |
|
|
|
|
| 567 |
let attempts = 0;
|
| 568 |
const interval = setInterval(() => {
|
| 569 |
attachResizers();
|
|
|
|
| 619 |
comp_reset_btn.click(fn=reset_comp_selections, inputs=None, outputs=[comp_standard, comp_version, comp_category])
|
| 620 |
|
| 621 |
|
| 622 |
+
# ==========================================
|
| 623 |
+
# 5. Application Styling (CSS)
|
| 624 |
+
# ==========================================
|
| 625 |
# ==========================================
|
| 626 |
# 5. Application Styling (CSS)
|
| 627 |
# ==========================================
|
| 628 |
css = """
|
| 629 |
+
/* 1. ํ
์ด๋ธ ๊ธฐ๋ณธ ์ค์ */
|
| 630 |
table {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 631 |
width: 100% !important;
|
| 632 |
+
border-collapse: collapse;
|
| 633 |
}
|
| 634 |
|
| 635 |
+
/* 2. ์
๋ด๋ถ ํ
์คํธ ๊ท์น (JS ์กฐ์์ ์ํด min-width ์กฑ์ ์๋ฒฝ ์ ๊ฑฐ) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
thead th {
|
| 637 |
font-size: 18px !important;
|
| 638 |
position: sticky;
|
|
|
|
| 640 |
background: white;
|
| 641 |
z-index: 10;
|
| 642 |
}
|
| 643 |
+
td, th {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 644 |
font-size: 18px !important;
|
| 645 |
+
word-break: break-word !important; /* ๊ธด ํ
์คํธ ํญ์ฃผ ๋ฐฉ์ง */
|
| 646 |
+
white-space: normal !important; /* ์ฌ์ ๊ณต๊ฐ์ ๋ง์ถฐ ์์ฐ์ค๋ฝ๊ฒ ์ค๋ฐ๊ฟ */
|
| 647 |
line-height: 1.6;
|
| 648 |
padding: 10px;
|
| 649 |
vertical-align: top !important;
|
|
|
|
| 653 |
display: block;
|
| 654 |
max-width: none !important;
|
| 655 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 656 |
|
| 657 |
+
/* 3. Gradio 6.x ์ ์ฉ: ํ ์จ๊น ๋ฐฉ์ด๋ง ์๋ฒฝ ํด์ */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 658 |
.gradio-container .dataframe,
|
| 659 |
.gradio-container .dataframe div,
|
| 660 |
.gradio-container thead,
|
|
|
|
| 662 |
.gradio-container th {
|
| 663 |
overflow: visible !important;
|
| 664 |
}
|
| 665 |
+
.dataframe {
|
| 666 |
+
max-height: none !important;
|
| 667 |
+
overflow-y: visible !important;
|
| 668 |
+
overflow-x: auto !important;
|
| 669 |
+
display: block;
|
| 670 |
+
}
|
| 671 |
|
| 672 |
+
/* 4. ํธ๋ค(Resizer) ๋์์ธ */
|
| 673 |
.resizer {
|
| 674 |
+
background-color: rgba(255, 0, 0, 0.5); /* ํ
์คํธ์ฉ ๋นจ๊ฐ์ (์๋ ํ์ธ ํ transparent๋ก ๋ณ๊ฒฝํ์ธ์) */
|
| 675 |
+
width: 8px !important;
|
| 676 |
height: 100%;
|
| 677 |
position: absolute;
|
| 678 |
right: 0;
|
| 679 |
top: 0;
|
| 680 |
cursor: col-resize;
|
| 681 |
+
z-index: 9999 !important;
|
| 682 |
+
}
|
| 683 |
+
.resizer:hover, .resizer.resizing {
|
| 684 |
+
background-color: #1a73e8 !important; /* ๋ง์ฐ์ค๋ก ์ก๊ณ ๋ ๋ ํ๋์ */
|
| 685 |
}
|
| 686 |
|
| 687 |
+
/* 5. ์ด๊ธฐ ๋ ๋๋ง ๋น์จ ์ ์ง (JS๊ฐ ์กฐ์ํ ์ ์๋๋ก !important ์ ๊ฑฐ) */
|
| 688 |
+
table:has(th:nth-last-child(2):first-child),
|
| 689 |
+
table:has(th:nth-last-child(4):first-child),
|
| 690 |
+
table:has(th:nth-last-child(5):first-child),
|
| 691 |
+
table:has(th:nth-last-child(6):first-child) {
|
| 692 |
+
table-layout: fixed;
|
| 693 |
}
|
| 694 |
+
|
| 695 |
+
table th:nth-last-child(2):first-child, table td:nth-last-child(2):first-child { width: 15%; }
|
| 696 |
+
table th:nth-last-child(1), table td:nth-last-child(1) { width: 85%; }
|
| 697 |
+
|
| 698 |
+
table th:nth-child(1):nth-last-child(4), table td:nth-child(1):nth-last-child(4) { width: 10%; }
|
| 699 |
+
table th:nth-child(2):nth-last-child(3), table td:nth-child(2):nth-last-child(3) { width: 40%; }
|
| 700 |
+
table th:nth-child(3):nth-last-child(2), table td:nth-child(3):nth-last-child(2) { width: 10%; }
|
| 701 |
+
table th:nth-child(4):nth-last-child(1), table td:nth-child(4):nth-last-child(1) { width: 40%; }
|
| 702 |
+
|
| 703 |
+
table th:nth-child(1):nth-last-child(5), table td:nth-child(1):nth-last-child(5) { width: 15%; }
|
| 704 |
+
table th:nth-child(2):nth-last-child(4), table td:nth-child(2):nth-last-child(4) { width: 10%; }
|
| 705 |
+
table th:nth-child(3):nth-last-child(3), table td:nth-child(3):nth-last-child(3) { width: 30%; }
|
| 706 |
+
table th:nth-child(4):nth-last-child(2), table td:nth-child(4):nth-last-child(2) { width: 10%; }
|
| 707 |
+
table th:nth-child(5):nth-last-child(1), table td:nth-child(5):nth-last-child(1) { width: 35%; }
|
| 708 |
+
|
| 709 |
+
table th:nth-child(1):nth-last-child(6), table td:nth-child(1):nth-last-child(6) { width: 8%; }
|
| 710 |
+
table th:nth-child(2):nth-last-child(5), table td:nth-child(2):nth-last-child(5) { width: 15%; }
|
| 711 |
+
table th:nth-child(3):nth-last-child(4), table td:nth-child(3):nth-last-child(4) { width: 27%; }
|
| 712 |
+
table th:nth-child(4):nth-last-child(3), table td:nth-child(4):nth-last-child(3) { width: 8%; }
|
| 713 |
+
table th:nth-child(5):nth-last-child(2), table td:nth-child(5):nth-last-child(2) { width: 15%; }
|
| 714 |
+
table th:nth-child(6):nth-last-child(1), table td:nth-child(6):nth-last-child(1) { width: 27%; }
|
| 715 |
"""
|
| 716 |
|
| 717 |
if __name__ == "__main__":
|