Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -149,33 +149,43 @@ def create_bar_chart(df, category):
|
|
149 |
st.plotly_chart(fig, use_container_width=True, height=len(df) * 35)
|
150 |
|
151 |
def fetch_merge_configs(df):
|
152 |
-
# Sort the
|
153 |
-
df_sorted = df.sort_values(by='Average', ascending=False)
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
try:
|
161 |
card = ModelCard.load(model_name)
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
# Main function to run the Streamlit app
|
181 |
def main():
|
|
|
149 |
st.plotly_chart(fig, use_container_width=True, height=len(df) * 35)
|
150 |
|
151 |
def fetch_merge_configs(df):
|
152 |
+
# Sort the data by the second column (assuming the column name is 'Average')
|
153 |
+
df_sorted = df.sort_values(by='Average', ascending=False)
|
154 |
+
|
155 |
+
# Open the file in append mode
|
156 |
+
with open('configurations.txt', 'a') as file:
|
157 |
+
# Get model cards for the top 20 entries
|
158 |
+
for index, row in df_sorted.head(20).iterrows():
|
159 |
+
model_name = row['Model'].rstrip()
|
|
|
160 |
card = ModelCard.load(model_name)
|
161 |
+
file.write(f'Model Name: {model_name}\n')
|
162 |
+
file.write(f'Scores: {row["Average"]}\n') # Assuming 'Average' is the benchmark score
|
163 |
+
file.write(f'AGIEval: {row["AGIEval"]}\n')
|
164 |
+
file.write(f'GPT4All: {row["GPT4All"]}\n')
|
165 |
+
file.write(f'TruthfulQA: {row["TruthfulQA"]}\n')
|
166 |
+
file.write(f'Bigbench: {row["Bigbench"]}\n')
|
167 |
+
file.write(f'Model Card: {card}\n')
|
168 |
+
|
169 |
+
# Open the second file in read mode
|
170 |
+
with open('configurations.txt', 'r') as file:
|
171 |
+
# Read the content
|
172 |
+
content = file.read()
|
173 |
+
|
174 |
+
# Find all text between 'yaml' and '```'
|
175 |
+
matches = re.findall(r'yaml(.*?)```', content, re.DOTALL)
|
176 |
+
|
177 |
+
# Open the file 'configurations2.txt' in write mode
|
178 |
+
with open('configurations2.txt', 'w') as file:
|
179 |
+
# Write the matches to the file
|
180 |
+
for row, match in zip(df_sorted[['Model', 'Average', 'AGIEval', 'GPT4All', 'TruthfulQA', 'Bigbench']].head(20).values, matches):
|
181 |
+
file.write(f'Model Name: {row[0]}\n')
|
182 |
+
file.write(f'Scores: {row[1]}\n')
|
183 |
+
file.write(f'AGIEval: {row[2]}\n')
|
184 |
+
file.write(f'GPT4All: {row[3]}\n')
|
185 |
+
file.write(f'TruthfulQA: {row[4]}\n')
|
186 |
+
file.write(f'Bigbench: {row[5]}\n')
|
187 |
+
file.write('yaml' + match + '```\n')
|
188 |
+
|
189 |
|
190 |
# Main function to run the Streamlit app
|
191 |
def main():
|