Spaces:
Running
Running
commit
Browse files
app.py
CHANGED
|
@@ -9,6 +9,8 @@ def display_table(exam_type):
|
|
| 9 |
cols = df.columns.tolist()
|
| 10 |
cols.insert(1, cols.pop(cols.index('Average')))
|
| 11 |
df = df[cols]
|
|
|
|
|
|
|
| 12 |
elif exam_type == "MMLU-Pro-Hy":
|
| 13 |
df = pd.read_csv('mmlu_pro_hy_results.csv')
|
| 14 |
subject_cols = ['Biology', 'Business', 'Chemistry', 'Computer Science', 'Economics', 'Engineering', 'Health', 'History', 'Law', 'Math', 'Other', 'Philosophy', 'Physics', 'Psychology']
|
|
@@ -19,13 +21,13 @@ def display_table(exam_type):
|
|
| 19 |
cols.insert(1, cols.pop(cols.index('Average')))
|
| 20 |
cols.append(cols.pop(cols.index('Other')))
|
| 21 |
df = df[cols]
|
|
|
|
| 22 |
return df
|
| 23 |
|
| 24 |
def create_bar_chart(exam_type, plot_column):
|
| 25 |
if exam_type == "Armenian Exams":
|
| 26 |
df = pd.read_csv('unified_exam_results.csv')
|
| 27 |
df = df.sort_values(by=[plot_column, 'Model'], ascending=[False, True]).reset_index(drop=True)
|
| 28 |
-
|
| 29 |
x_col = plot_column
|
| 30 |
title = f'{plot_column}'
|
| 31 |
x_range_max = 20
|
|
@@ -37,7 +39,6 @@ def create_bar_chart(exam_type, plot_column):
|
|
| 37 |
else:
|
| 38 |
return "Distinction"
|
| 39 |
df['Test Result'] = df[plot_column].apply(get_label)
|
| 40 |
-
|
| 41 |
color_discrete_map = {
|
| 42 |
"Fail": "#ff5f56",
|
| 43 |
"Pass": "#ffbd2e",
|
|
@@ -51,27 +52,24 @@ def create_bar_chart(exam_type, plot_column):
|
|
| 51 |
labels={x_col: 'Score', 'Model': 'Model'},
|
| 52 |
title=title,
|
| 53 |
orientation='h')
|
| 54 |
-
|
| 55 |
fig.update_layout(
|
| 56 |
xaxis=dict(range=[0, x_range_max]),
|
| 57 |
title=dict(text=title, font=dict(size=16)),
|
| 58 |
xaxis_title=dict(font=dict(size=12)),
|
| 59 |
yaxis_title=dict(font=dict(size=12)),
|
| 60 |
-
yaxis=dict(autorange="reversed")
|
|
|
|
| 61 |
)
|
| 62 |
-
|
| 63 |
return fig
|
| 64 |
-
|
| 65 |
elif exam_type == "MMLU-Pro-Hy":
|
| 66 |
df = pd.read_csv('mmlu_pro_hy_results.csv')
|
| 67 |
subject_cols = ['Biology', 'Business', 'Chemistry', 'Computer Science', 'Economics', 'Engineering', 'Health', 'History', 'Law', 'Math', 'Other', 'Philosophy', 'Physics', 'Psychology']
|
| 68 |
df['Average'] = df[subject_cols].mean(axis=1)
|
| 69 |
-
df = df.sort_values(by=
|
| 70 |
df = df.drop(columns=['Accuracy'])
|
| 71 |
x_col = plot_column
|
| 72 |
title = f'{plot_column}'
|
| 73 |
x_range_max = 1.0
|
| 74 |
-
|
| 75 |
fig = px.bar(df,
|
| 76 |
x=x_col,
|
| 77 |
y='Model',
|
|
@@ -81,35 +79,37 @@ def create_bar_chart(exam_type, plot_column):
|
|
| 81 |
title=title,
|
| 82 |
orientation='h',
|
| 83 |
range_color=[0,1])
|
| 84 |
-
|
| 85 |
fig.update_layout(
|
| 86 |
xaxis=dict(range=[0, x_range_max]),
|
| 87 |
title=dict(text=title, font=dict(size=16)),
|
| 88 |
xaxis_title=dict(font=dict(size=12)),
|
| 89 |
yaxis_title=dict(font=dict(size=12)),
|
| 90 |
-
yaxis=dict(autorange="reversed")
|
|
|
|
| 91 |
)
|
| 92 |
-
|
| 93 |
return fig
|
| 94 |
|
| 95 |
with gr.Blocks() as app:
|
| 96 |
with gr.Tabs():
|
| 97 |
with gr.TabItem("Armenian Unified Exams"):
|
| 98 |
gr.Markdown("# Armenian Unified Test Exams")
|
| 99 |
-
gr.
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
| 102 |
table_output_armenian = gr.DataFrame(value=lambda: display_table("Armenian Exams"))
|
| 103 |
plot_column_dropdown = gr.Dropdown(choices=['Average', 'Armenian language and literature', 'Armenian history', 'Mathematics'], value='Average', label='Select Column to Plot')
|
| 104 |
plot_output_armenian = gr.Plot(lambda column: create_bar_chart("Armenian Exams", column), inputs=plot_column_dropdown)
|
| 105 |
with gr.TabItem("MMLU-Pro-Hy"):
|
| 106 |
gr.Markdown("# MMLU-Pro Translated to Armenian (MMLU-Pro-Hy)")
|
| 107 |
-
gr.
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
table_output_mmlu = gr.DataFrame(value=lambda: display_table("MMLU-Pro-Hy"))
|
| 111 |
-
subject_cols = ['Biology', 'Business', 'Chemistry', 'Computer Science', 'Economics', 'Engineering', 'Health', 'History', 'Law', 'Math', '
|
| 112 |
plot_column_dropdown_mmlu = gr.Dropdown(choices=subject_cols, value='Average', label='Select Column to Plot')
|
| 113 |
plot_output_mmlu = gr.Plot(lambda column: create_bar_chart("MMLU-Pro-Hy", column), inputs=plot_column_dropdown_mmlu)
|
| 114 |
-
|
| 115 |
app.launch(share=True, debug=True)
|
|
|
|
| 9 |
cols = df.columns.tolist()
|
| 10 |
cols.insert(1, cols.pop(cols.index('Average')))
|
| 11 |
df = df[cols]
|
| 12 |
+
df.rename(columns={'Armenian language and literature': 'Armenian language\nand literature'}, inplace=True)
|
| 13 |
+
df = df.round(4)
|
| 14 |
elif exam_type == "MMLU-Pro-Hy":
|
| 15 |
df = pd.read_csv('mmlu_pro_hy_results.csv')
|
| 16 |
subject_cols = ['Biology', 'Business', 'Chemistry', 'Computer Science', 'Economics', 'Engineering', 'Health', 'History', 'Law', 'Math', 'Other', 'Philosophy', 'Physics', 'Psychology']
|
|
|
|
| 21 |
cols.insert(1, cols.pop(cols.index('Average')))
|
| 22 |
cols.append(cols.pop(cols.index('Other')))
|
| 23 |
df = df[cols]
|
| 24 |
+
df = df.round(4)
|
| 25 |
return df
|
| 26 |
|
| 27 |
def create_bar_chart(exam_type, plot_column):
|
| 28 |
if exam_type == "Armenian Exams":
|
| 29 |
df = pd.read_csv('unified_exam_results.csv')
|
| 30 |
df = df.sort_values(by=[plot_column, 'Model'], ascending=[False, True]).reset_index(drop=True)
|
|
|
|
| 31 |
x_col = plot_column
|
| 32 |
title = f'{plot_column}'
|
| 33 |
x_range_max = 20
|
|
|
|
| 39 |
else:
|
| 40 |
return "Distinction"
|
| 41 |
df['Test Result'] = df[plot_column].apply(get_label)
|
|
|
|
| 42 |
color_discrete_map = {
|
| 43 |
"Fail": "#ff5f56",
|
| 44 |
"Pass": "#ffbd2e",
|
|
|
|
| 52 |
labels={x_col: 'Score', 'Model': 'Model'},
|
| 53 |
title=title,
|
| 54 |
orientation='h')
|
|
|
|
| 55 |
fig.update_layout(
|
| 56 |
xaxis=dict(range=[0, x_range_max]),
|
| 57 |
title=dict(text=title, font=dict(size=16)),
|
| 58 |
xaxis_title=dict(font=dict(size=12)),
|
| 59 |
yaxis_title=dict(font=dict(size=12)),
|
| 60 |
+
yaxis=dict(autorange="reversed"),
|
| 61 |
+
autosize=True
|
| 62 |
)
|
|
|
|
| 63 |
return fig
|
|
|
|
| 64 |
elif exam_type == "MMLU-Pro-Hy":
|
| 65 |
df = pd.read_csv('mmlu_pro_hy_results.csv')
|
| 66 |
subject_cols = ['Biology', 'Business', 'Chemistry', 'Computer Science', 'Economics', 'Engineering', 'Health', 'History', 'Law', 'Math', 'Other', 'Philosophy', 'Physics', 'Psychology']
|
| 67 |
df['Average'] = df[subject_cols].mean(axis=1)
|
| 68 |
+
df = df.sort_values(by=plot_column, ascending=False).reset_index(drop=True)
|
| 69 |
df = df.drop(columns=['Accuracy'])
|
| 70 |
x_col = plot_column
|
| 71 |
title = f'{plot_column}'
|
| 72 |
x_range_max = 1.0
|
|
|
|
| 73 |
fig = px.bar(df,
|
| 74 |
x=x_col,
|
| 75 |
y='Model',
|
|
|
|
| 79 |
title=title,
|
| 80 |
orientation='h',
|
| 81 |
range_color=[0,1])
|
|
|
|
| 82 |
fig.update_layout(
|
| 83 |
xaxis=dict(range=[0, x_range_max]),
|
| 84 |
title=dict(text=title, font=dict(size=16)),
|
| 85 |
xaxis_title=dict(font=dict(size=12)),
|
| 86 |
yaxis_title=dict(font=dict(size=12)),
|
| 87 |
+
yaxis=dict(autorange="reversed"),
|
| 88 |
+
autosize=True
|
| 89 |
)
|
|
|
|
| 90 |
return fig
|
| 91 |
|
| 92 |
with gr.Blocks() as app:
|
| 93 |
with gr.Tabs():
|
| 94 |
with gr.TabItem("Armenian Unified Exams"):
|
| 95 |
gr.Markdown("# Armenian Unified Test Exams")
|
| 96 |
+
gr.HTML(f"""
|
| 97 |
+
<div style="font-size: 16px;">
|
| 98 |
+
This benchmark contains results of various Language Models on Armenian Unified Test Exams for Armenian language and literature, Armenian history and mathematics. The scoring system is a 20-point scale, where 0-8 is a Fail, 8-18 is a Pass, and 18-20 is a Distinction.
|
| 99 |
+
</div>
|
| 100 |
+
""")
|
| 101 |
table_output_armenian = gr.DataFrame(value=lambda: display_table("Armenian Exams"))
|
| 102 |
plot_column_dropdown = gr.Dropdown(choices=['Average', 'Armenian language and literature', 'Armenian history', 'Mathematics'], value='Average', label='Select Column to Plot')
|
| 103 |
plot_output_armenian = gr.Plot(lambda column: create_bar_chart("Armenian Exams", column), inputs=plot_column_dropdown)
|
| 104 |
with gr.TabItem("MMLU-Pro-Hy"):
|
| 105 |
gr.Markdown("# MMLU-Pro Translated to Armenian (MMLU-Pro-Hy)")
|
| 106 |
+
gr.HTML(f"""
|
| 107 |
+
<div style="font-size: 16px;">
|
| 108 |
+
This benchmark contains results of various Language Models on the MMLU-Pro benchmark, translated into Armenian. MMLU-Pro is a massive multi-task test in MCQA format. The scores represent accuracy.
|
| 109 |
+
</div>
|
| 110 |
+
""")
|
| 111 |
table_output_mmlu = gr.DataFrame(value=lambda: display_table("MMLU-Pro-Hy"))
|
| 112 |
+
subject_cols = ['Average','Biology', 'Business', 'Chemistry', 'Computer Science', 'Economics', 'Engineering', 'Health', 'History', 'Law', 'Math', 'Philosophy', 'Physics', 'Psychology','Other']
|
| 113 |
plot_column_dropdown_mmlu = gr.Dropdown(choices=subject_cols, value='Average', label='Select Column to Plot')
|
| 114 |
plot_output_mmlu = gr.Plot(lambda column: create_bar_chart("MMLU-Pro-Hy", column), inputs=plot_column_dropdown_mmlu)
|
|
|
|
| 115 |
app.launch(share=True, debug=True)
|