Amit Kumar
commited on
Commit
Β·
dac144a
1
Parent(s):
f83ddbf
added tabs
Browse files- about/__pycache__/custom_css.cpython-310.pyc +0 -0
- about/custom_css.py +107 -0
- app.py +23 -80
about/__pycache__/custom_css.cpython-310.pyc
ADDED
|
Binary file (1.86 kB). View file
|
|
|
about/custom_css.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
custom_css = """
|
| 2 |
+
#linguist-image img {
|
| 3 |
+
max-width: 300px;
|
| 4 |
+
height: auto;
|
| 5 |
+
margin: 0 auto;
|
| 6 |
+
display: block;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
.custom-tab-button {
|
| 10 |
+
background-color: #004d99;
|
| 11 |
+
color: white;
|
| 12 |
+
padding: 8px 16px;
|
| 13 |
+
border-radius: 8px;
|
| 14 |
+
margin-right: 4px;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.custom-tab-button:hover {
|
| 18 |
+
background-color: #0066cc;
|
| 19 |
+
}
|
| 20 |
+
.markdown-text {
|
| 21 |
+
font-size: 16px !important;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
#models-to-add-text {
|
| 25 |
+
font-size: 18px !important;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
#citation-button span {
|
| 29 |
+
font-size: 16px !important;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
#citation-button textarea {
|
| 33 |
+
font-size: 16px !important;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
#citation-button > label > button {
|
| 37 |
+
margin: 6px;
|
| 38 |
+
transform: scale(1.3);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
#leaderboard-table {
|
| 42 |
+
margin-top: 15px
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
#leaderboard-table-lite {
|
| 46 |
+
margin-top: 15px
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
#search-bar-table-box > div:first-child {
|
| 50 |
+
background: none;
|
| 51 |
+
border: none;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
#search-bar {
|
| 55 |
+
padding: 0px;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.tab-buttons button {
|
| 59 |
+
font-size: 20px;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
#scale-logo {
|
| 63 |
+
border-style: none !important;
|
| 64 |
+
box-shadow: none;
|
| 65 |
+
display: block;
|
| 66 |
+
margin-left: auto;
|
| 67 |
+
margin-right: auto;
|
| 68 |
+
max-width: 600px;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
#scale-logo .download {
|
| 72 |
+
display: none;
|
| 73 |
+
}
|
| 74 |
+
#filter_type{
|
| 75 |
+
border: 0;
|
| 76 |
+
padding-left: 0;
|
| 77 |
+
padding-top: 0;
|
| 78 |
+
}
|
| 79 |
+
#filter_type label {
|
| 80 |
+
display: flex;
|
| 81 |
+
}
|
| 82 |
+
#filter_type label > span{
|
| 83 |
+
margin-top: var(--spacing-lg);
|
| 84 |
+
margin-right: 0.5em;
|
| 85 |
+
}
|
| 86 |
+
#filter_type label > .wrap{
|
| 87 |
+
width: 103px;
|
| 88 |
+
}
|
| 89 |
+
#filter_type label > .wrap .wrap-inner{
|
| 90 |
+
padding: 2px;
|
| 91 |
+
}
|
| 92 |
+
#filter_type label > .wrap .wrap-inner input{
|
| 93 |
+
width: 1px
|
| 94 |
+
}
|
| 95 |
+
#filter-columns-type{
|
| 96 |
+
border:0;
|
| 97 |
+
padding:0.5;
|
| 98 |
+
}
|
| 99 |
+
#filter-columns-size{
|
| 100 |
+
border:0;
|
| 101 |
+
padding:0.5;
|
| 102 |
+
}
|
| 103 |
+
#box-filter > .form{
|
| 104 |
+
border: 0
|
| 105 |
+
}
|
| 106 |
+
"""
|
| 107 |
+
|
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
| 4 |
import markdown
|
|
|
|
| 5 |
LEADERBOARD_DIR = "leaderboard_files"
|
| 6 |
LEADERBOARD_FILE = os.path.join(LEADERBOARD_DIR, "leaderboard_data.csv")
|
| 7 |
DESCRIPTION_FILE = "about/description.md"
|
|
@@ -52,87 +53,29 @@ def filter_leaderboard(selected_params, selected_shots, selected_data):
|
|
| 52 |
|
| 53 |
return filtered[cols_to_show]
|
| 54 |
|
| 55 |
-
with gr.Blocks() as demo:
|
| 56 |
gr.HTML("<h1 style='text-align: center;'>π Medical Classification Leaderboard - Beta</h1>")
|
| 57 |
gr.Image("./about/linguist.png", elem_id="linguist-image", show_label=False)
|
| 58 |
-
|
| 59 |
-
# Add CSS to style the leaderboard table
|
| 60 |
-
demo.css = """
|
| 61 |
-
#linguist-image img {
|
| 62 |
-
max-width: 300px;
|
| 63 |
-
height: auto;
|
| 64 |
-
margin: 0 auto;
|
| 65 |
-
display: block;
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
/* Style the leaderboard label */
|
| 69 |
-
label[for*="leaderboard_table"] {
|
| 70 |
-
font-size: 24px;
|
| 71 |
-
font-weight: bold;
|
| 72 |
-
color: #2c3e50;
|
| 73 |
-
text-align: center;
|
| 74 |
-
margin-bottom: 10px;
|
| 75 |
-
display: block;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
/* Table headers */
|
| 79 |
-
.dataframe thead th {
|
| 80 |
-
background-color: #4CAF50;
|
| 81 |
-
color: white;
|
| 82 |
-
font-size: 16px;
|
| 83 |
-
font-weight: bold;
|
| 84 |
-
padding: 12px;
|
| 85 |
-
text-align: left;
|
| 86 |
-
border-bottom: 2px solid #ccc;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
/* Table cells */
|
| 90 |
-
.dataframe tbody td {
|
| 91 |
-
font-size: 14px;
|
| 92 |
-
padding: 10px 15px; /* Add horizontal spacing */
|
| 93 |
-
color: #333;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
/* First and second columns spacing */
|
| 97 |
-
.dataframe tbody td:first-child,
|
| 98 |
-
.dataframe tbody td:nth-child(2) {
|
| 99 |
-
padding-left: 20px;
|
| 100 |
-
padding-right: 20px;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
/* Zebra striping */
|
| 104 |
-
.dataframe tbody tr:nth-child(even) {
|
| 105 |
-
background-color: #f9f9f9;
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
/* Add hover effect */
|
| 109 |
-
.dataframe tbody tr:hover {
|
| 110 |
-
background-color: #e6f7ff;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
/* Make sure the table is not squished */
|
| 114 |
-
.dataframe {
|
| 115 |
-
table-layout: auto;
|
| 116 |
-
width: 100%;
|
| 117 |
-
border-collapse: collapse;
|
| 118 |
-
}
|
| 119 |
-
"""
|
| 120 |
-
|
| 121 |
gr.HTML(load_description(DESCRIPTION_FILE))
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
demo.launch()
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
| 4 |
import markdown
|
| 5 |
+
from about.custom_css import custom_css
|
| 6 |
LEADERBOARD_DIR = "leaderboard_files"
|
| 7 |
LEADERBOARD_FILE = os.path.join(LEADERBOARD_DIR, "leaderboard_data.csv")
|
| 8 |
DESCRIPTION_FILE = "about/description.md"
|
|
|
|
| 53 |
|
| 54 |
return filtered[cols_to_show]
|
| 55 |
|
| 56 |
+
with gr.Blocks(css = custom_css) as demo:
|
| 57 |
gr.HTML("<h1 style='text-align: center;'>π Medical Classification Leaderboard - Beta</h1>")
|
| 58 |
gr.Image("./about/linguist.png", elem_id="linguist-image", show_label=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
gr.HTML(load_description(DESCRIPTION_FILE))
|
| 60 |
+
with gr.Tab("π
LLM Benchmark", elem_classes="custom-tab-buttons") as tabs:
|
| 61 |
+
with gr.Row():
|
| 62 |
+
with gr.Column():
|
| 63 |
+
column_selector_data = gr.CheckboxGroup(label="π Select Columns to Display - Dataset", choices=["Chexpert Plus", "CT Rate"], value=["Chexpert Plus", "CT Rate"])
|
| 64 |
+
|
| 65 |
+
with gr.Column():
|
| 66 |
+
shot_filter = gr.CheckboxGroup(label="Select Shot Type", choices=shot_options, value=shot_options)
|
| 67 |
+
param_filter = gr.CheckboxGroup(choices=parameter_options, label="Filter by Parameter Count", value=parameter_options)
|
| 68 |
+
|
| 69 |
+
initial_data = filter_leaderboard(parameter_options, shot_options, ["Chexpert Plus", "CT Rate"])
|
| 70 |
+
leaderboard_table = gr.Dataframe(value=initial_data, label="π
Leaderboard", interactive=False, elem_id="leaderboard-table")
|
| 71 |
+
column_selector_data.change(filter_leaderboard, inputs=[param_filter, shot_filter, column_selector_data], outputs=leaderboard_table)
|
| 72 |
+
param_filter.change(fn=filter_leaderboard, inputs=[param_filter, shot_filter, column_selector_data], outputs=leaderboard_table)
|
| 73 |
+
shot_filter.change(fn=filter_leaderboard, inputs=[param_filter, shot_filter, column_selector_data], outputs=leaderboard_table)
|
| 74 |
+
|
| 75 |
+
with gr.Tab("π Submit Prompt or model here! ", elem_classes="custom-tab-buttons"):
|
| 76 |
+
gr.Markdown("""
|
| 77 |
+
This is a placeholder for the prompt submission feature.
|
| 78 |
+
You can add your own functionality here.
|
| 79 |
+
""")
|
| 80 |
+
# Add your prompt submission code here
|
| 81 |
demo.launch()
|