Spaces:
Running
Running
Code cleanup and added comparison
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import re
|
2 |
import streamlit as st
|
3 |
import requests
|
@@ -9,6 +10,9 @@ from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
|
9 |
from yall import create_yall
|
10 |
from functools import cache
|
11 |
|
|
|
|
|
|
|
12 |
@cache
|
13 |
def cached_model_info(api, model):
|
14 |
try:
|
@@ -16,6 +20,7 @@ def cached_model_info(api, model):
|
|
16 |
except (RepositoryNotFoundError, RevisionNotFoundError):
|
17 |
return None
|
18 |
|
|
|
19 |
@st.cache
|
20 |
def get_model_info(df):
|
21 |
api = HfApi()
|
@@ -30,7 +35,7 @@ def get_model_info(df):
|
|
30 |
df.loc[index, 'Tags'] = ''
|
31 |
return df
|
32 |
|
33 |
-
|
34 |
def convert_markdown_table_to_dataframe(md_content):
|
35 |
"""
|
36 |
Converts markdown table to Pandas DataFrame, handling special characters and links,
|
@@ -79,8 +84,7 @@ def get_model_info(df):
|
|
79 |
|
80 |
return df
|
81 |
|
82 |
-
|
83 |
-
|
84 |
def create_bar_chart(df, category):
|
85 |
"""Create and display a bar chart for a given category."""
|
86 |
st.write(f"### {category} Scores")
|
@@ -104,16 +108,15 @@ def create_bar_chart(df, category):
|
|
104 |
# Adjust the height of the chart based on the number of rows in the DataFrame
|
105 |
st.plotly_chart(fig, use_container_width=True, height=len(df) * 35)
|
106 |
|
107 |
-
#
|
108 |
-
# create_bar_chart(your_dataframe, 'Your_Category')
|
109 |
-
|
110 |
-
|
111 |
def main():
|
|
|
112 |
st.set_page_config(page_title="YALL - Yet Another LLM Leaderboard", layout="wide")
|
113 |
|
114 |
st.title("π YALL - Yet Another LLM Leaderboard")
|
115 |
st.markdown("Leaderboard made with π§ [LLM AutoEval](https://github.com/mlabonne/llm-autoeval) using [Nous](https://huggingface.co/NousResearch) benchmark suite.")
|
116 |
|
|
|
117 |
content = create_yall()
|
118 |
tab1, tab2 = st.tabs(["π Leaderboard", "π About"])
|
119 |
|
@@ -125,9 +128,11 @@ def main():
|
|
125 |
|
126 |
# Display dataframe
|
127 |
full_df = convert_markdown_table_to_dataframe(content)
|
|
|
128 |
for col in score_columns:
|
129 |
# Corrected use of pd.to_numeric
|
130 |
full_df[col] = pd.to_numeric(full_df[col].str.strip(), errors='coerce')
|
|
|
131 |
full_df = get_model_info(full_df)
|
132 |
full_df['Tags'] = full_df['Tags'].fillna('')
|
133 |
df = pd.DataFrame(columns=full_df.columns)
|
@@ -241,5 +246,6 @@ def main():
|
|
241 |
A special thanks to [gblazex](https://huggingface.co/gblazex) for providing many evaluations.
|
242 |
''')
|
243 |
|
|
|
244 |
if __name__ == "__main__":
|
245 |
main()
|
|
|
1 |
+
# Importing necessary libraries
|
2 |
import re
|
3 |
import streamlit as st
|
4 |
import requests
|
|
|
10 |
from yall import create_yall
|
11 |
from functools import cache
|
12 |
|
13 |
+
|
14 |
+
|
15 |
+
# Function to get model info from Hugging Face API using caching
|
16 |
@cache
|
17 |
def cached_model_info(api, model):
|
18 |
try:
|
|
|
20 |
except (RepositoryNotFoundError, RevisionNotFoundError):
|
21 |
return None
|
22 |
|
23 |
+
# Function to get model info from DataFrame and update it with likes and tags
|
24 |
@st.cache
|
25 |
def get_model_info(df):
|
26 |
api = HfApi()
|
|
|
35 |
df.loc[index, 'Tags'] = ''
|
36 |
return df
|
37 |
|
38 |
+
# Function to convert markdown table to DataFrame and extract Hugging Face URLs
|
39 |
def convert_markdown_table_to_dataframe(md_content):
|
40 |
"""
|
41 |
Converts markdown table to Pandas DataFrame, handling special characters and links,
|
|
|
84 |
|
85 |
return df
|
86 |
|
87 |
+
# Function to create bar chart for a given category
|
|
|
88 |
def create_bar_chart(df, category):
|
89 |
"""Create and display a bar chart for a given category."""
|
90 |
st.write(f"### {category} Scores")
|
|
|
108 |
# Adjust the height of the chart based on the number of rows in the DataFrame
|
109 |
st.plotly_chart(fig, use_container_width=True, height=len(df) * 35)
|
110 |
|
111 |
+
# Main function to run the Streamlit app
|
|
|
|
|
|
|
112 |
def main():
|
113 |
+
# Set page configuration and title
|
114 |
st.set_page_config(page_title="YALL - Yet Another LLM Leaderboard", layout="wide")
|
115 |
|
116 |
st.title("π YALL - Yet Another LLM Leaderboard")
|
117 |
st.markdown("Leaderboard made with π§ [LLM AutoEval](https://github.com/mlabonne/llm-autoeval) using [Nous](https://huggingface.co/NousResearch) benchmark suite.")
|
118 |
|
119 |
+
# Create tabs for leaderboard and about section
|
120 |
content = create_yall()
|
121 |
tab1, tab2 = st.tabs(["π Leaderboard", "π About"])
|
122 |
|
|
|
128 |
|
129 |
# Display dataframe
|
130 |
full_df = convert_markdown_table_to_dataframe(content)
|
131 |
+
|
132 |
for col in score_columns:
|
133 |
# Corrected use of pd.to_numeric
|
134 |
full_df[col] = pd.to_numeric(full_df[col].str.strip(), errors='coerce')
|
135 |
+
|
136 |
full_df = get_model_info(full_df)
|
137 |
full_df['Tags'] = full_df['Tags'].fillna('')
|
138 |
df = pd.DataFrame(columns=full_df.columns)
|
|
|
246 |
A special thanks to [gblazex](https://huggingface.co/gblazex) for providing many evaluations.
|
247 |
''')
|
248 |
|
249 |
+
# Run the main function if this script is run directly
|
250 |
if __name__ == "__main__":
|
251 |
main()
|