File size: 2,695 Bytes
b782462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9eb5abe
b782462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9eb5abe
b782462
 
 
9eb5abe
b782462
 
 
 
 
 
 
9eb5abe
b782462
 
 
9eb5abe
b782462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import gradio as gr
import pandas as pd
from constants import INTRODUCTION_TEXT,CITATION_TEXT


# Define the formatter function
def formatter(x):
    try:
        return round(x, 2)
    except:
        return x


# Example DataFrames

jsond_data = pd.read_json('big.json')
original_df = pd.DataFrame(jsond_data)
print(original_df)

jsond_data2 = pd.read_json('small.json')
Small_original_df = pd.DataFrame(jsond_data2)
print(Small_original_df)

# Apply formatter to the entire DataFrame
original_df = original_df.applymap(formatter)
Small_original_df=Small_original_df.applymap(formatter)


# Correct data types for Gradio DataFrame component
TYPES = ['str', 'number', 'number', 'number']


LAST_UPDATED = "June 9th 2024"

# CSS for styling
css = """
.markdown-text{font-size: 200pt}
.markdown-text-small{font-size: 13pt}
th {
  text-align: center;
}
td {
  font-size: 15px; /* Adjust the font size as needed */
  text-align: center;
}
#od-benchmark-tab-table-button{
    font-size: 15pt;
    font-weight: bold;
}

#Intro{
font-size: 100pt;
}
"""


def build_demo(original_df,Small_original_df, TYPES):
    with gr.Blocks(css=css) as demo:
        gr.Markdown(INTRODUCTION_TEXT, elem_id="Intro")
        with gr.Tabs():
            with gr.TabItem("🏅Large-Scale LLMs leaderboard",elem_id="od-benchmark-tab-table", id=0):
                leaderboard_table = gr.components.Dataframe(
                    value=original_df,
                    datatype=TYPES,
                    label="Leaderboard_Large",
                    height=1000,
                    wrap=False,
                    interactive=False,
                    visible=True,
                    min_width=60,
                )
          
            with gr.TabItem("🏅Small-Scale LLMS leaderboard",elem_id="od-benchmark-tab-table", id=1):
                leaderboard_table = gr.components.Dataframe(
                    value=Small_original_df,
                    datatype=TYPES,
                    label="Leaderboard_Small",
                    height=1000,
                    wrap=False,
                    interactive=False,
                    visible=True,
                    min_width=60,
                )

                
        gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text-small")
        
        with gr.Row():
            with gr.Accordion("📙 Citation", open=False):
                gr.Textbox(
                    value=CITATION_TEXT, lines=18,
                    label="",
                    elem_id="citation-button",
                    show_copy_button=True)

    return demo

demo = build_demo(original_df,Small_original_df, TYPES)
demo.launch(share='True')