Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -86,37 +86,37 @@ def get_model_info(df):
|
|
86 |
|
87 |
return df
|
88 |
|
89 |
-
def calculate_highest_combined_score(data, column):
|
90 |
-
score_columns = ['Average', 'AGIEval', 'GPT4All', 'TruthfulQA', 'Bigbench']
|
91 |
-
# Ensure the column exists and has numeric data
|
92 |
-
if column not in data.columns or not pd.api.types.is_numeric_dtype(data[column]):
|
93 |
-
return column, {}
|
94 |
-
scores = data[column].dropna().tolist()
|
95 |
-
models = data['Model'].tolist()
|
96 |
-
top_combinations = {r: [] for r in range(2, 5)}
|
97 |
-
for r in range(2, 5):
|
98 |
-
for combination in combinations(zip(scores, models), r):
|
99 |
-
combined_score = sum(score for score, _ in combination)
|
100 |
-
top_combinations[r].append((combined_score, tuple(model for _, model in combination)))
|
101 |
-
top_combinations[r].sort(key=lambda x: x[0], reverse=True)
|
102 |
-
top_combinations[r] = top_combinations[r][:5]
|
103 |
-
return column, top_combinations
|
104 |
-
|
105 |
-
|
106 |
-
def display_highest_combined_scores(data):
|
107 |
-
score_columns = ['Average', 'AGIEval', 'GPT4All', 'TruthfulQA', 'Bigbench']
|
108 |
-
with st.spinner('Calculating highest combined scores...'):
|
109 |
-
results = [calculate_highest_combined_score(data, col) for col in score_columns]
|
110 |
-
for column, top_combinations in results:
|
111 |
-
st.subheader(f"Top Combinations for {column}")
|
112 |
-
for r, combinations in top_combinations.items():
|
113 |
-
# Prepare data for DataFrame
|
114 |
-
rows = [{'Score': score, 'Models': ', '.join(combination)} for score, combination in combinations]
|
115 |
-
df = pd.DataFrame(rows)
|
116 |
-
|
117 |
-
# Display using st.dataframe
|
118 |
-
st.markdown(f"**Number of Models: {r}**")
|
119 |
-
st.dataframe(df, height=150) # Adjust height as necessary
|
120 |
|
121 |
|
122 |
|
@@ -263,7 +263,7 @@ def main():
|
|
263 |
with col4:
|
264 |
create_bar_chart(df, score_columns[4])
|
265 |
|
266 |
-
display_highest_combined_scores(full_df) # Call to display the calculated scores
|
267 |
except Exception as e:
|
268 |
st.error("An error occurred while processing the markdown table.")
|
269 |
st.error(str(e))
|
|
|
86 |
|
87 |
return df
|
88 |
|
89 |
+
#def calculate_highest_combined_score(data, column):
|
90 |
+
# score_columns = ['Average', 'AGIEval', 'GPT4All', 'TruthfulQA', 'Bigbench']
|
91 |
+
# # Ensure the column exists and has numeric data
|
92 |
+
# if column not in data.columns or not pd.api.types.is_numeric_dtype(data[column]):
|
93 |
+
# return column, {}
|
94 |
+
# scores = data[column].dropna().tolist()
|
95 |
+
# models = data['Model'].tolist()
|
96 |
+
# top_combinations = {r: [] for r in range(2, 5)}
|
97 |
+
# for r in range(2, 5):
|
98 |
+
# for combination in combinations(zip(scores, models), r):
|
99 |
+
# combined_score = sum(score for score, _ in combination)
|
100 |
+
# top_combinations[r].append((combined_score, tuple(model for _, model in combination)))
|
101 |
+
# top_combinations[r].sort(key=lambda x: x[0], reverse=True)
|
102 |
+
# top_combinations[r] = top_combinations[r][:5]
|
103 |
+
# return column, top_combinations
|
104 |
+
|
105 |
+
## Modified function to display the results of the highest combined scores using st.dataframe
|
106 |
+
#def display_highest_combined_scores(data):
|
107 |
+
# score_columns = ['Average', 'AGIEval', 'GPT4All', 'TruthfulQA', 'Bigbench']
|
108 |
+
# with st.spinner('Calculating highest combined scores...'):
|
109 |
+
# results = [calculate_highest_combined_score(data, col) for col in score_columns]
|
110 |
+
# for column, top_combinations in results:
|
111 |
+
# st.subheader(f"Top Combinations for {column}")
|
112 |
+
# for r, combinations in top_combinations.items():
|
113 |
+
# # Prepare data for DataFrame
|
114 |
+
# rows = [{'Score': score, 'Models': ', '.join(combination)} for score, combination in combinations]
|
115 |
+
# df = pd.DataFrame(rows)
|
116 |
+
#
|
117 |
+
# # Display using st.dataframe
|
118 |
+
# st.markdown(f"**Number of Models: {r}**")
|
119 |
+
# st.dataframe(df, height=150) # Adjust height as necessary
|
120 |
|
121 |
|
122 |
|
|
|
263 |
with col4:
|
264 |
create_bar_chart(df, score_columns[4])
|
265 |
|
266 |
+
# display_highest_combined_scores(full_df) # Call to display the calculated scores
|
267 |
except Exception as e:
|
268 |
st.error("An error occurred while processing the markdown table.")
|
269 |
st.error(str(e))
|