feat(app): update app functionality and connect to server - Adithya S K
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import re
|
2 |
import streamlit as st
|
3 |
import requests
|
@@ -6,22 +7,94 @@ from io import StringIO
|
|
6 |
import plotly.graph_objs as go
|
7 |
from huggingface_hub import HfApi
|
8 |
from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
|
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def main():
|
|
|
12 |
st.set_page_config(page_title="Indic LLM Leaderboard", layout="wide")
|
13 |
-
|
14 |
title_column, refresh_column = st.columns([.92, 0.08])
|
15 |
with title_column:
|
16 |
-
st.title("Indic LLM Leaderboard")
|
17 |
-
|
18 |
-
st.markdown("Leaderboard made with π§ [Easy Eval](hhttps://github.com/adithya-s-k/easy_eval) using [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) benchmark suite.")
|
19 |
with refresh_column:
|
20 |
-
st.button("Refresh", type="primary")
|
|
|
21 |
|
22 |
Leaderboard_tab, About_tab ,FAQ_tab, Submit_tab = st.tabs(["π
Leaderboard", "π About" , "βFAQ","π Submit"])
|
23 |
|
24 |
with Leaderboard_tab:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
title = st.text_input('Model Name', placeholder=" π Search for your model (separate multiple queries with `;`) and press ENTER...")
|
26 |
|
27 |
col1, col2 = st.columns(2)
|
@@ -32,15 +105,50 @@ def main():
|
|
32 |
with col2:
|
33 |
language_options = st.multiselect(
|
34 |
'Pick Languages',
|
35 |
-
['
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
compare_models = st.multiselect(
|
42 |
-
'Pick
|
43 |
-
['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# About tab
|
46 |
with About_tab:
|
@@ -50,20 +158,31 @@ def main():
|
|
50 |
### Indic Eval
|
51 |
|
52 |
### Contribute
|
53 |
-
|
54 |
''')
|
55 |
|
56 |
# FAQ tab
|
57 |
with FAQ_tab:
|
58 |
st.markdown('''
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
with Submit_tab:
|
64 |
st.markdown('''
|
65 |
-
|
66 |
-
|
|
|
67 |
|
68 |
with st.expander(label="π Citation"):
|
69 |
code = '''
|
@@ -77,8 +196,5 @@ def main():
|
|
77 |
'''
|
78 |
st.code(code, language='python')
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
if __name__ == "__main__":
|
84 |
main()
|
|
|
1 |
+
import os
|
2 |
import re
|
3 |
import streamlit as st
|
4 |
import requests
|
|
|
7 |
import plotly.graph_objs as go
|
8 |
from huggingface_hub import HfApi
|
9 |
from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
10 |
+
from dotenv import load_dotenv
|
11 |
|
12 |
+
load_dotenv()
|
13 |
+
|
14 |
+
SERVER_URL = os.getenv("SERVER_URL")
|
15 |
+
|
16 |
+
def get_data():
|
17 |
+
response = requests.get(SERVER_URL)
|
18 |
+
data = response.json()
|
19 |
+
return data
|
20 |
|
21 |
def main():
|
22 |
+
|
23 |
st.set_page_config(page_title="Indic LLM Leaderboard", layout="wide")
|
24 |
+
|
25 |
title_column, refresh_column = st.columns([.92, 0.08])
|
26 |
with title_column:
|
27 |
+
st.title("Indic LLM Leaderboard (Ξ±)")
|
28 |
+
st.markdown("The Indic Eval Leaderboard utilizes the [indic_eval](https://github.com/adithya-s-k/indic_eval) evaluation framework , incorporating SOTA translated benchmarks like ARC, Hellaswag, MMLU, among others. Supporting 7 Indic languages, it offers a comprehensive platform for assessing model performance and comparing results within the Indic language modeling landscape.")
|
|
|
29 |
with refresh_column:
|
30 |
+
if st.button("Refresh", type="primary"):
|
31 |
+
data = get_data()
|
32 |
|
33 |
Leaderboard_tab, About_tab ,FAQ_tab, Submit_tab = st.tabs(["π
Leaderboard", "π About" , "βFAQ","π Submit"])
|
34 |
|
35 |
with Leaderboard_tab:
|
36 |
+
data = get_data()
|
37 |
+
|
38 |
+
table_data = []
|
39 |
+
all_models = []
|
40 |
+
|
41 |
+
for item in data:
|
42 |
+
model_name = item.get("name")
|
43 |
+
language = item.get("language")
|
44 |
+
try:
|
45 |
+
ALL = item["result"]["all"]["acc_norm"]
|
46 |
+
except KeyError:
|
47 |
+
ALL = None
|
48 |
+
try:
|
49 |
+
ARC_Easy = item["result"]["ARC-Easy"]["acc_norm"]
|
50 |
+
except KeyError:
|
51 |
+
ARC_Easy = None
|
52 |
+
try:
|
53 |
+
ARC_Challenge = item["result"]["ARC-Challenge"]["acc_norm"]
|
54 |
+
except KeyError:
|
55 |
+
ARC_Challenge = None
|
56 |
+
try:
|
57 |
+
Hellaswag = item["result"]["Hellaswag"]["acc_norm"]
|
58 |
+
except KeyError:
|
59 |
+
Hellaswag = None
|
60 |
+
try:
|
61 |
+
Boolq = item["result"]["Boolq"]["acc_norm"]
|
62 |
+
except KeyError:
|
63 |
+
Boolq = None
|
64 |
+
try:
|
65 |
+
MMLU = item["result"]["MMLU"]["acc_norm"]
|
66 |
+
except KeyError:
|
67 |
+
MMLU = None
|
68 |
+
try:
|
69 |
+
Winograde = item["result"]["Winograde"]["acc_norm"]
|
70 |
+
except KeyError:
|
71 |
+
Winograde = None
|
72 |
+
try:
|
73 |
+
Translation = item["result"]["Translation"]["acc_norm"]
|
74 |
+
except KeyError:
|
75 |
+
Translation = None
|
76 |
+
try:
|
77 |
+
Generation = item["result"]["Generation"]["acc_norm"]
|
78 |
+
except KeyError:
|
79 |
+
Generation = None
|
80 |
+
|
81 |
+
all_models.append(model_name)
|
82 |
+
table_data.append({
|
83 |
+
"Model Name": model_name,
|
84 |
+
"Language": language,
|
85 |
+
"Avergae": ALL,
|
86 |
+
"ARC-Easy": ARC_Easy,
|
87 |
+
"ARC-Challenge": ARC_Challenge,
|
88 |
+
"Hellaswag": Hellaswag,
|
89 |
+
"Boolq": Boolq,
|
90 |
+
"MMLU": MMLU,
|
91 |
+
"Winograde": Winograde,
|
92 |
+
"Translation": Translation,
|
93 |
+
"Generation": Generation
|
94 |
+
})
|
95 |
+
|
96 |
+
df = pd.DataFrame(table_data)
|
97 |
+
|
98 |
title = st.text_input('Model Name', placeholder=" π Search for your model (separate multiple queries with `;`) and press ENTER...")
|
99 |
|
100 |
col1, col2 = st.columns(2)
|
|
|
105 |
with col2:
|
106 |
language_options = st.multiselect(
|
107 |
'Pick Languages',
|
108 |
+
['kannada', 'hindi', 'tamil', 'telegu','gujarathi','marathi','malayalam'],['kannada', 'hindi', 'tamil', 'telegu','gujarathi','marathi','malayalam'])
|
109 |
+
|
110 |
+
if title:
|
111 |
+
if ';' in title:
|
112 |
+
model_names = [name.strip() for name in title.split(';')]
|
113 |
+
filtered_df = df[df['Model Name'].isin(model_names)]
|
114 |
+
else:
|
115 |
+
filtered_df = df[df['Model Name'].str.contains(title, case=False, na=False)]
|
116 |
|
117 |
+
filtered_df = filtered_df[filtered_df['Language'].isin(language_options)]
|
118 |
+
filtered_df = filtered_df[df.columns.intersection(['Model Name', 'Language'] + benchmark_options)]
|
119 |
+
|
120 |
+
# Calculate average across selected benchmark columns
|
121 |
+
filtered_df['Average'] = filtered_df[benchmark_options].mean(axis=1)
|
122 |
+
|
123 |
+
# Display the filtered DataFrame
|
124 |
+
st.dataframe(filtered_df, use_container_width=True)
|
125 |
+
elif benchmark_options or language_options:
|
126 |
+
filtered_df = df[df['Language'].isin(language_options)]
|
127 |
+
filtered_df = filtered_df[df.columns.intersection(['Model Name', 'Language'] + benchmark_options)]
|
128 |
+
|
129 |
+
# Calculate average across selected benchmark columns
|
130 |
+
filtered_df['Average'] = filtered_df[benchmark_options].mean(axis=1)
|
131 |
+
|
132 |
+
st.dataframe(filtered_df, use_container_width=True)
|
133 |
+
|
134 |
+
# Multiselect for comparing models
|
135 |
compare_models = st.multiselect(
|
136 |
+
'Pick Models to compare them',
|
137 |
+
df['Model Name'].unique()
|
138 |
+
)
|
139 |
+
|
140 |
+
# Display DataFrame for selected models and their scores
|
141 |
+
if compare_models:
|
142 |
+
compare_data = []
|
143 |
+
for model in compare_models:
|
144 |
+
model_data = df[df['Model Name'] == model]
|
145 |
+
compare_data.append(model_data)
|
146 |
+
if compare_data:
|
147 |
+
compare_df = pd.concat(compare_data)
|
148 |
+
compare_df['Average'] = compare_df[benchmark_options].mean(axis=1) # Calculate average
|
149 |
+
st.dataframe(compare_df, use_container_width=True)
|
150 |
+
|
151 |
+
|
152 |
|
153 |
# About tab
|
154 |
with About_tab:
|
|
|
158 |
### Indic Eval
|
159 |
|
160 |
### Contribute
|
|
|
161 |
''')
|
162 |
|
163 |
# FAQ tab
|
164 |
with FAQ_tab:
|
165 |
st.markdown('''
|
166 |
+
### FAQ
|
167 |
+
|
168 |
+
### SUBMISSIONS
|
169 |
+
|
170 |
+
|
171 |
+
### RESULTS
|
172 |
+
|
173 |
+
|
174 |
+
### EDITING SUBMISSIONS
|
175 |
+
|
176 |
+
|
177 |
+
### OTHER
|
178 |
+
''')
|
179 |
+
|
180 |
+
# Submit tab
|
181 |
with Submit_tab:
|
182 |
st.markdown('''
|
183 |
+
### Submit Your Model
|
184 |
+
''')
|
185 |
+
|
186 |
|
187 |
with st.expander(label="π Citation"):
|
188 |
code = '''
|
|
|
196 |
'''
|
197 |
st.code(code, language='python')
|
198 |
|
|
|
|
|
|
|
199 |
if __name__ == "__main__":
|
200 |
main()
|