Corey Morris
commited on
Commit
•
e3642ff
1
Parent(s):
24e7049
Revert "Moved dataframe to above the multiselect"
Browse filesThis reverts commit 24e70497d85670e051a28058b96ba0e1bc82fb87.
app.py
CHANGED
@@ -23,12 +23,17 @@ class MultiURLData:
|
|
23 |
with open(filename) as f:
|
24 |
data = json.load(f)
|
25 |
df = pd.DataFrame(data['results']).T
|
|
|
26 |
df = df.rename(columns={'acc': model_name})
|
|
|
27 |
df.index = df.index.str.replace('hendrycksTest-', '')
|
|
|
28 |
df.index = df.index.str.replace('harness\\|', '')
|
|
|
29 |
dataframes.append(df[[model_name]])
|
30 |
|
31 |
data = pd.concat(dataframes, axis=1)
|
|
|
32 |
data = data.transpose()
|
33 |
data['Model Name'] = data.index
|
34 |
cols = data.columns.tolist()
|
@@ -37,56 +42,26 @@ class MultiURLData:
|
|
37 |
|
38 |
return data
|
39 |
|
40 |
-
def get_top_performing_models(self, column_name, top_n):
|
41 |
-
sorted_data = self.data.sort_values(by=column_name, ascending=False)
|
42 |
-
return sorted_data['Model Name'].head(top_n).tolist()
|
43 |
-
|
44 |
def get_data(self, selected_models):
|
45 |
filtered_data = self.data[self.data['Model Name'].isin(selected_models)]
|
46 |
return filtered_data
|
47 |
-
|
48 |
|
49 |
data_provider = MultiURLData()
|
50 |
|
51 |
-
#
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
# Function to display multiselects
|
70 |
-
def display_multiselects():
|
71 |
-
models = models_multiselect.multiselect(
|
72 |
-
'Select Models',
|
73 |
-
data_provider.data['Model Name'].tolist(),
|
74 |
-
default=selected_models
|
75 |
-
)
|
76 |
-
columns = columns_multiselect.multiselect(
|
77 |
-
'Select Columns',
|
78 |
-
data_provider.data.columns.tolist(),
|
79 |
-
default=selected_columns
|
80 |
-
)
|
81 |
-
return models, columns
|
82 |
-
|
83 |
-
# Display dataframe initially
|
84 |
-
display_dataframe(selected_models, selected_columns)
|
85 |
-
|
86 |
-
# Display multiselects initially
|
87 |
-
selected_models, selected_columns = display_multiselects()
|
88 |
-
|
89 |
-
# If the user clicks the "Update" button, update the selected models and columns
|
90 |
-
# and redisplay the dataframe
|
91 |
-
if st.button('Update'):
|
92 |
-
display_dataframe(selected_models, selected_columns)
|
|
|
23 |
with open(filename) as f:
|
24 |
data = json.load(f)
|
25 |
df = pd.DataFrame(data['results']).T
|
26 |
+
|
27 |
df = df.rename(columns={'acc': model_name})
|
28 |
+
|
29 |
df.index = df.index.str.replace('hendrycksTest-', '')
|
30 |
+
|
31 |
df.index = df.index.str.replace('harness\\|', '')
|
32 |
+
|
33 |
dataframes.append(df[[model_name]])
|
34 |
|
35 |
data = pd.concat(dataframes, axis=1)
|
36 |
+
|
37 |
data = data.transpose()
|
38 |
data['Model Name'] = data.index
|
39 |
cols = data.columns.tolist()
|
|
|
42 |
|
43 |
return data
|
44 |
|
|
|
|
|
|
|
|
|
45 |
def get_data(self, selected_models):
|
46 |
filtered_data = self.data[self.data['Model Name'].isin(selected_models)]
|
47 |
return filtered_data
|
|
|
48 |
|
49 |
data_provider = MultiURLData()
|
50 |
|
51 |
+
# Create checkboxes for each column
|
52 |
+
selected_columns = st.multiselect(
|
53 |
+
'Select Columns',
|
54 |
+
data_provider.data.columns.tolist(),
|
55 |
+
default=data_provider.data.columns.tolist()
|
56 |
+
)
|
57 |
+
|
58 |
+
selected_models = st.multiselect(
|
59 |
+
'Select Models',
|
60 |
+
data_provider.data['Model Name'].tolist(),
|
61 |
+
default=data_provider.data['Model Name'].tolist()
|
62 |
+
)
|
63 |
+
|
64 |
+
|
65 |
+
# Get the filtered data and display it in a table
|
66 |
+
filtered_data = data_provider.get_data(selected_models)
|
67 |
+
st.dataframe(filtered_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|