Spaces:
Running
Running
Yuxuan-Zhang-Dexter
commited on
Commit
·
8dcd7a7
1
Parent(s):
d72d8b5
fix freezing issue
Browse files
app.py
CHANGED
@@ -151,7 +151,7 @@ def update_df_with_height(df):
|
|
151 |
show_fullscreen_button=True,
|
152 |
line_breaks=True,
|
153 |
show_search="search",
|
154 |
-
max_height=
|
155 |
column_widths=col_widths)
|
156 |
|
157 |
def update_leaderboard(mario_overall, mario_details,
|
@@ -499,10 +499,9 @@ def build_app():
|
|
499 |
with gr.Blocks(css="""
|
500 |
/* Fix for disappearing scrollbar */
|
501 |
html, body {
|
502 |
-
overflow-y:
|
503 |
-
overflow-x: hidden !important;
|
504 |
-
width: 100% !important;
|
505 |
height: 100% !important;
|
|
|
506 |
}
|
507 |
|
508 |
/* Prevent content from shrinking to center */
|
@@ -514,34 +513,27 @@ def build_app():
|
|
514 |
min-height: 100vh !important;
|
515 |
}
|
516 |
|
517 |
-
/*
|
518 |
.table-container {
|
519 |
width: 100% !important;
|
520 |
-
|
521 |
-
border-radius: 8px;
|
522 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
523 |
}
|
524 |
|
525 |
-
|
526 |
-
|
527 |
-
[data-testid="dataframe"] [data-testid="table"],
|
528 |
-
.gradio-dataframe tbody,
|
529 |
-
[data-testid="dataframe"] tbody,
|
530 |
-
.table-container > div,
|
531 |
-
.table-container > div > div {
|
532 |
-
overflow: visible !important;
|
533 |
-
max-height: none !important;
|
534 |
}
|
535 |
|
536 |
-
/* Visualization styling */
|
537 |
.visualization-container .js-plotly-plot {
|
538 |
margin-left: auto !important;
|
539 |
margin-right: auto !important;
|
540 |
display: block !important;
|
|
|
|
|
|
|
|
|
541 |
max-width: 1000px;
|
542 |
}
|
543 |
-
|
544 |
-
/* Section styling */
|
545 |
.section-title {
|
546 |
font-size: 1.5em;
|
547 |
font-weight: bold;
|
@@ -551,6 +543,103 @@ def build_app():
|
|
551 |
border-bottom: 2px solid #e9ecef;
|
552 |
text-align: center;
|
553 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
|
555 |
/* Fix table styling */
|
556 |
.table-container table {
|
@@ -560,6 +649,26 @@ def build_app():
|
|
560 |
table-layout: fixed !important;
|
561 |
}
|
562 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
/* Column width customization - adjust for row numbers being first column */
|
564 |
.table-container th:nth-child(2),
|
565 |
.table-container td:nth-child(2) {
|
@@ -618,7 +727,15 @@ def build_app():
|
|
618 |
background-color: #f8fafc;
|
619 |
}
|
620 |
|
621 |
-
/* Row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
.gradio-dataframe thead tr th[id="0"],
|
623 |
.gradio-dataframe tbody tr td:nth-child(1),
|
624 |
[data-testid="dataframe"] thead tr th[id="0"],
|
@@ -632,6 +749,26 @@ def build_app():
|
|
632 |
text-align: center !important;
|
633 |
font-size: 0.85em !important;
|
634 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
635 |
""") as demo:
|
636 |
gr.Markdown("# 🎮 Game Arena: Gaming Agent 🎲")
|
637 |
|
@@ -743,7 +880,7 @@ def build_app():
|
|
743 |
show_row_numbers=True,
|
744 |
show_fullscreen_button=True,
|
745 |
line_breaks=True,
|
746 |
-
max_height=
|
747 |
show_search="search",
|
748 |
column_widths=col_widths
|
749 |
)
|
|
|
151 |
show_fullscreen_button=True,
|
152 |
line_breaks=True,
|
153 |
show_search="search",
|
154 |
+
max_height=700,
|
155 |
column_widths=col_widths)
|
156 |
|
157 |
def update_leaderboard(mario_overall, mario_details,
|
|
|
499 |
with gr.Blocks(css="""
|
500 |
/* Fix for disappearing scrollbar */
|
501 |
html, body {
|
502 |
+
overflow-y: scroll !important;
|
|
|
|
|
503 |
height: 100% !important;
|
504 |
+
min-height: 100vh !important;
|
505 |
}
|
506 |
|
507 |
/* Prevent content from shrinking to center */
|
|
|
513 |
min-height: 100vh !important;
|
514 |
}
|
515 |
|
516 |
+
/* Force table to maintain width */
|
517 |
.table-container {
|
518 |
width: 100% !important;
|
519 |
+
min-width: 100% !important;
|
|
|
|
|
520 |
}
|
521 |
|
522 |
+
.table-container table {
|
523 |
+
width: 100% !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
}
|
525 |
|
|
|
526 |
.visualization-container .js-plotly-plot {
|
527 |
margin-left: auto !important;
|
528 |
margin-right: auto !important;
|
529 |
display: block !important;
|
530 |
+
}
|
531 |
+
|
532 |
+
/* Optional: limit width for better layout on large screens */
|
533 |
+
.visualization-container .js-plotly-plot {
|
534 |
max-width: 1000px;
|
535 |
}
|
536 |
+
|
|
|
537 |
.section-title {
|
538 |
font-size: 1.5em;
|
539 |
font-weight: bold;
|
|
|
543 |
border-bottom: 2px solid #e9ecef;
|
544 |
text-align: center;
|
545 |
}
|
546 |
+
.container {
|
547 |
+
max-width: 1400px;
|
548 |
+
margin: 0 auto;
|
549 |
+
padding: 0 20px;
|
550 |
+
}
|
551 |
+
|
552 |
+
/* Enhanced table styling - SIMPLIFIED */
|
553 |
+
.table-container {
|
554 |
+
height: auto !important;
|
555 |
+
min-height: auto !important;
|
556 |
+
max-height: none !important;
|
557 |
+
overflow: visible !important;
|
558 |
+
border-radius: 8px;
|
559 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
560 |
+
}
|
561 |
+
|
562 |
+
/* Target the specific table elements */
|
563 |
+
.gradio-dataframe [data-testid="table"],
|
564 |
+
[data-testid="dataframe"] [data-testid="table"] {
|
565 |
+
display: block !important;
|
566 |
+
height: auto !important;
|
567 |
+
max-height: none !important;
|
568 |
+
}
|
569 |
+
|
570 |
+
/* Target the tbody that contains the rows */
|
571 |
+
.gradio-dataframe tbody,
|
572 |
+
[data-testid="dataframe"] tbody {
|
573 |
+
display: table-row-group !important;
|
574 |
+
max-height: none !important;
|
575 |
+
}
|
576 |
+
|
577 |
+
/* Responsive height adjustments for different screen sizes */
|
578 |
+
@media screen and (min-height: 600px) {
|
579 |
+
.gradio-dataframe [data-testid="table"],
|
580 |
+
[data-testid="dataframe"] [data-testid="table"] {
|
581 |
+
min-height: 400px !important;
|
582 |
+
}
|
583 |
+
}
|
584 |
+
|
585 |
+
@media screen and (min-height: 800px) {
|
586 |
+
.gradio-dataframe [data-testid="table"],
|
587 |
+
[data-testid="dataframe"] [data-testid="table"] {
|
588 |
+
min-height: 600px !important;
|
589 |
+
}
|
590 |
+
}
|
591 |
+
|
592 |
+
@media screen and (min-height: 1000px) {
|
593 |
+
.gradio-dataframe [data-testid="table"],
|
594 |
+
[data-testid="dataframe"] [data-testid="table"] {
|
595 |
+
min-height: 800px !important;
|
596 |
+
}
|
597 |
+
}
|
598 |
+
|
599 |
+
@media screen and (min-height: 1200px) {
|
600 |
+
.gradio-dataframe [data-testid="table"],
|
601 |
+
[data-testid="dataframe"] [data-testid="table"] {
|
602 |
+
min-height: 950px !important;
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
+
@media screen and (min-height: 1400px) {
|
607 |
+
.gradio-dataframe [data-testid="table"],
|
608 |
+
[data-testid="dataframe"] [data-testid="table"] {
|
609 |
+
min-height: 1100px !important;
|
610 |
+
}
|
611 |
+
}
|
612 |
+
|
613 |
+
/* Remove unnecessary container styles */
|
614 |
+
.table-container > div,
|
615 |
+
.table-container > div > div,
|
616 |
+
.gradio-dataframe > div,
|
617 |
+
[data-testid="dataframe"] > div {
|
618 |
+
overflow: visible !important;
|
619 |
+
height: auto !important;
|
620 |
+
max-height: none !important;
|
621 |
+
}
|
622 |
+
|
623 |
+
/* Target Gradio's pagination system and disable it */
|
624 |
+
.table-container [data-testid="pagination"],
|
625 |
+
.gradio-container [data-testid="pagination"] {
|
626 |
+
display: none !important;
|
627 |
+
}
|
628 |
+
|
629 |
+
/* Large screen adjustments */
|
630 |
+
@media screen and (min-height: 1200px) {
|
631 |
+
.table-container {
|
632 |
+
height: auto !important;
|
633 |
+
max-height: none !important;
|
634 |
+
overflow: visible !important;
|
635 |
+
}
|
636 |
+
|
637 |
+
.gradio-container {
|
638 |
+
height: auto !important;
|
639 |
+
max-height: none !important;
|
640 |
+
overflow: visible !important;
|
641 |
+
}
|
642 |
+
}
|
643 |
|
644 |
/* Fix table styling */
|
645 |
.table-container table {
|
|
|
649 |
table-layout: fixed !important;
|
650 |
}
|
651 |
|
652 |
+
/* Targeting row number column directly */
|
653 |
+
table th[role="cell"][aria-colindex="1"],
|
654 |
+
table td[role="cell"][aria-colindex="1"],
|
655 |
+
table col[data-col-index="0"],
|
656 |
+
.table-container tr > *:first-child[aria-colindex="1"],
|
657 |
+
th[scope="row"],
|
658 |
+
th[aria-sort],
|
659 |
+
td[data-index],
|
660 |
+
th[data-row-header] {
|
661 |
+
width: 30px !important;
|
662 |
+
min-width: 30px !important;
|
663 |
+
max-width: 30px !important;
|
664 |
+
padding: 2px 4px !important;
|
665 |
+
font-size: 0.85em !important;
|
666 |
+
text-align: center !important;
|
667 |
+
overflow: hidden !important;
|
668 |
+
text-overflow: ellipsis !important;
|
669 |
+
white-space: nowrap !important;
|
670 |
+
}
|
671 |
+
|
672 |
/* Column width customization - adjust for row numbers being first column */
|
673 |
.table-container th:nth-child(2),
|
674 |
.table-container td:nth-child(2) {
|
|
|
727 |
background-color: #f8fafc;
|
728 |
}
|
729 |
|
730 |
+
/* Row containing the table */
|
731 |
+
.gradio-container .gr-row {
|
732 |
+
min-height: auto !important;
|
733 |
+
height: auto !important;
|
734 |
+
overflow: visible !important;
|
735 |
+
margin-bottom: 20px;
|
736 |
+
}
|
737 |
+
|
738 |
+
/* Additional specific selectors for row numbers */
|
739 |
.gradio-dataframe thead tr th[id="0"],
|
740 |
.gradio-dataframe tbody tr td:nth-child(1),
|
741 |
[data-testid="dataframe"] thead tr th[id="0"],
|
|
|
749 |
text-align: center !important;
|
750 |
font-size: 0.85em !important;
|
751 |
}
|
752 |
+
|
753 |
+
/* Fix overflow issues */
|
754 |
+
.table-container {
|
755 |
+
overflow: auto !important;
|
756 |
+
max-height: 700px !important;
|
757 |
+
}
|
758 |
+
|
759 |
+
body, html {
|
760 |
+
overflow-x: hidden !important;
|
761 |
+
overflow-y: auto !important;
|
762 |
+
height: 100% !important;
|
763 |
+
width: 100% !important;
|
764 |
+
margin: 0 !important;
|
765 |
+
padding: 0 !important;
|
766 |
+
}
|
767 |
+
|
768 |
+
.gradio-container {
|
769 |
+
overflow: visible !important;
|
770 |
+
max-height: none !important;
|
771 |
+
}
|
772 |
""") as demo:
|
773 |
gr.Markdown("# 🎮 Game Arena: Gaming Agent 🎲")
|
774 |
|
|
|
880 |
show_row_numbers=True,
|
881 |
show_fullscreen_button=True,
|
882 |
line_breaks=True,
|
883 |
+
max_height=700,
|
884 |
show_search="search",
|
885 |
column_widths=col_widths
|
886 |
)
|