Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,42 @@ import plotly.graph_objs as go
|
|
7 |
from huggingface_hub import HfApi
|
8 |
from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
9 |
|
10 |
-
from yall import create_yall
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
def convert_markdown_table_to_dataframe(md_content):
|
@@ -89,61 +123,34 @@ def create_bar_chart(df, category):
|
|
89 |
|
90 |
|
91 |
def main():
|
92 |
-
st.set_page_config(page_title="
|
93 |
|
94 |
-
st.title("
|
95 |
-
st.markdown("Leaderboard
|
96 |
-
content = create_yall()
|
97 |
-
tab1, tab2 = st.tabs(["
|
98 |
|
99 |
-
|
100 |
with tab1:
|
101 |
-
if
|
102 |
try:
|
103 |
-
score_columns = ['Elo']
|
104 |
-
|
105 |
-
# Display dataframe
|
106 |
-
full_df = convert_markdown_table_to_dataframe(content)
|
107 |
-
for col in score_columns:
|
108 |
-
# Corrected use of pd.to_numeric
|
109 |
-
full_df[col] = pd.to_numeric(full_df[col].str.strip(), errors='coerce')
|
110 |
-
full_df = get_model_info(full_df)
|
111 |
-
full_df['Tags'] = full_df['Tags'].fillna('')
|
112 |
-
df = pd.DataFrame(columns=full_df.columns)
|
113 |
-
|
114 |
-
# Create a DataFrame based on selected filters
|
115 |
-
dfs_to_concat = []
|
116 |
-
|
117 |
-
# Concatenate the DataFrames
|
118 |
-
if dfs_to_concat:
|
119 |
-
df = pd.concat(dfs_to_concat, ignore_index=True)
|
120 |
-
|
121 |
-
# Sort values
|
122 |
df = df.sort_values(by='Elo', ascending=False)
|
123 |
-
|
124 |
# Add a search bar
|
125 |
search_query = st.text_input("Search models", "")
|
126 |
-
|
127 |
-
# Filter the DataFrame based on the search query
|
128 |
-
if search_query:
|
129 |
-
df = df[df['Model'].str.contains(search_query, case=False)]
|
130 |
-
|
131 |
# Display the filtered DataFrame or the entire leaderboard
|
132 |
st.dataframe(
|
133 |
-
df[['Model'
|
134 |
use_container_width=True,
|
135 |
column_config={
|
136 |
-
"
|
137 |
-
"Likes",
|
138 |
-
help="Number of likes on Hugging Face",
|
139 |
-
format="%d β€οΈ",
|
140 |
-
),
|
141 |
-
"URL": st.column_config.LinkColumn("URL"),
|
142 |
},
|
143 |
hide_index=True,
|
144 |
-
height=int(len(df) * 36.2),
|
145 |
)
|
146 |
|
|
|
|
|
|
|
|
|
147 |
# Comparison between models
|
148 |
selected_models = st.multiselect('Select models to compare', df['Model'].unique())
|
149 |
comparison_df = df[df['Model'].isin(selected_models)]
|
@@ -151,12 +158,7 @@ def main():
|
|
151 |
comparison_df,
|
152 |
use_container_width=True,
|
153 |
column_config={
|
154 |
-
"
|
155 |
-
"Likes",
|
156 |
-
help="Number of likes on Hugging Face",
|
157 |
-
format="%d β€οΈ",
|
158 |
-
),
|
159 |
-
"URL": st.column_config.LinkColumn("URL"),
|
160 |
},
|
161 |
hide_index=True,
|
162 |
)
|
@@ -176,21 +178,12 @@ def main():
|
|
176 |
)
|
177 |
|
178 |
# Full-width plot for the first category
|
179 |
-
create_bar_chart(df,
|
180 |
|
181 |
# Next two plots in two columns
|
182 |
col1, col2 = st.columns(2)
|
183 |
with col1:
|
184 |
-
create_bar_chart(df,
|
185 |
-
with col2:
|
186 |
-
create_bar_chart(df, score_columns[2])
|
187 |
-
|
188 |
-
# Last two plots in two columns
|
189 |
-
col3, col4 = st.columns(2)
|
190 |
-
with col3:
|
191 |
-
create_bar_chart(df, score_columns[3])
|
192 |
-
with col4:
|
193 |
-
create_bar_chart(df, score_columns[4])
|
194 |
|
195 |
|
196 |
except Exception as e:
|
|
|
7 |
from huggingface_hub import HfApi
|
8 |
from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
9 |
|
10 |
+
#from yall import create_yall
|
11 |
+
|
12 |
+
def place_holder_dataframe():
|
13 |
+
list_dict = [
|
14 |
+
{"gist_id":"mistralai/Mistral-7B-Instruct-v0.3",
|
15 |
+
"filename":"https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3/blob/main/README.md",
|
16 |
+
"url":"https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3",
|
17 |
+
"model_name":"Mistral-7B-Instruct-v0.3",
|
18 |
+
"model_id":"mistralai/Mistral-7B-Instruct-v0.3",
|
19 |
+
"Model":"Mistral-7B-Instruct-v0.3",
|
20 |
+
"Elo":1200,
|
21 |
+
"Undetected rate":0.27
|
22 |
+
},
|
23 |
+
{
|
24 |
+
"gist_id":"mistralai/Mixtral-8x22B-Instruct-v0.1",
|
25 |
+
"filename":"https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1/blob/main/README.md",
|
26 |
+
"url":"https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1",
|
27 |
+
"model_name":"Mixtral-8x22B-Instruct-v0.1",
|
28 |
+
"model_id":"mistralai/Mixtral-8x22B-Instruct-v0.1",
|
29 |
+
"Model":"Mixtral-8x22B-Instruct-v0.1",
|
30 |
+
"Elo":1950,
|
31 |
+
"Undetected rate":0.63
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"gist_id":"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
35 |
+
"filename":"https://huggingface.co/mistralai/Mixtral-8x7B-v0.1/blob/main/README.md",
|
36 |
+
"url":"https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1",
|
37 |
+
"model_name":"Mixtral-8x7B-Instruct-v0.1",
|
38 |
+
"model_id":"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
39 |
+
"Model":"Mixtral-8x7B-Instruct-v0.1",
|
40 |
+
"Elo":1467,
|
41 |
+
"Undetected rate":0.41
|
42 |
+
}
|
43 |
+
]
|
44 |
+
df = pd.DataFrame(list_dict)
|
45 |
+
return df
|
46 |
|
47 |
|
48 |
def convert_markdown_table_to_dataframe(md_content):
|
|
|
123 |
|
124 |
|
125 |
def main():
|
126 |
+
st.set_page_config(page_title="LLM Roleplay Leaderboard", layout="wide")
|
127 |
|
128 |
+
st.title("ππ LLM Roleplay Leaderboard")
|
129 |
+
st.markdown("LLM Roleplay Leaderboard that uses scores from the matou garou roleplay game π πβ.")
|
130 |
+
#content = create_yall()
|
131 |
+
tab1, tab2 = st.tabs(["ππ Leaderboard", "π About"])
|
132 |
|
133 |
+
df = place_holder_dataframe()
|
134 |
with tab1:
|
135 |
+
if len(df)>0:
|
136 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
df = df.sort_values(by='Elo', ascending=False)
|
|
|
138 |
# Add a search bar
|
139 |
search_query = st.text_input("Search models", "")
|
|
|
|
|
|
|
|
|
|
|
140 |
# Display the filtered DataFrame or the entire leaderboard
|
141 |
st.dataframe(
|
142 |
+
df[['Model', 'Elo', 'url', 'Undetected rate']],
|
143 |
use_container_width=True,
|
144 |
column_config={
|
145 |
+
"url": st.column_config.LinkColumn("url"),
|
|
|
|
|
|
|
|
|
|
|
146 |
},
|
147 |
hide_index=True,
|
|
|
148 |
)
|
149 |
|
150 |
+
# Filter the DataFrame based on the search query
|
151 |
+
if search_query:
|
152 |
+
df = df[df['Model'].str.contains(search_query, case=False)]
|
153 |
+
|
154 |
# Comparison between models
|
155 |
selected_models = st.multiselect('Select models to compare', df['Model'].unique())
|
156 |
comparison_df = df[df['Model'].isin(selected_models)]
|
|
|
158 |
comparison_df,
|
159 |
use_container_width=True,
|
160 |
column_config={
|
161 |
+
"url": st.column_config.LinkColumn("url"),
|
|
|
|
|
|
|
|
|
|
|
162 |
},
|
163 |
hide_index=True,
|
164 |
)
|
|
|
178 |
)
|
179 |
|
180 |
# Full-width plot for the first category
|
181 |
+
create_bar_chart(df, "Elo")
|
182 |
|
183 |
# Next two plots in two columns
|
184 |
col1, col2 = st.columns(2)
|
185 |
with col1:
|
186 |
+
create_bar_chart(df, "Undetected rate")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
|
189 |
except Exception as e:
|