xinchen9 commited on
Commit
525d51f
1 Parent(s): e3d2fb3

[Update]add model1_column

Browse files
Files changed (1) hide show
  1. app.py +26 -3
app.py CHANGED
@@ -86,7 +86,7 @@ df_results_init = df_results.copy()[show_columns]
86
 
87
  def update_table(
88
  hidden_df: pd.DataFrame,
89
- # columns: list,
90
  #type_query: list,
91
  open_query: list,
92
  # precision_query: str,
@@ -102,7 +102,7 @@ def update_table(
102
  # filtered_df = filtered_df[filtered_df['Unlearned_Methods'].isin(open_query)]
103
  # map_open = {'open': 'Yes', 'closed': 'No'}
104
  # filtered_df = filtered_df[filtered_df['Open?'].isin([map_open[o] for o in open_query])]
105
-
106
  filtered_df = filter_queries(query, filtered_df)
107
  # filtered_df = filtered_df[[map_columns[k] for k in columns]]
108
  # deduplication
@@ -131,6 +131,27 @@ def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
131
 
132
  return filtered_df
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  demo = gr.Blocks(css=custom_css)
135
  with demo:
136
  gr.HTML(TITLE)
@@ -212,6 +233,7 @@ with demo:
212
  [
213
  # df_avg,
214
  hidden_leaderboard_table_for_search,
 
215
  # shown_columns,
216
  #type_query,
217
  open_query,
@@ -225,12 +247,13 @@ with demo:
225
  )
226
 
227
  #for selector in [type_query, open_query]:
228
- for selector in [open_query]:
229
  selector.change(
230
  update_table,
231
  [
232
  # df_avg,
233
  hidden_leaderboard_table_for_search,
 
234
  # shown_columns,
235
  #type_query,
236
  open_query,
 
86
 
87
  def update_table(
88
  hidden_df: pd.DataFrame,
89
+ model1_column: list,
90
  #type_query: list,
91
  open_query: list,
92
  # precision_query: str,
 
102
  # filtered_df = filtered_df[filtered_df['Unlearned_Methods'].isin(open_query)]
103
  # map_open = {'open': 'Yes', 'closed': 'No'}
104
  # filtered_df = filtered_df[filtered_df['Open?'].isin([map_open[o] for o in open_query])]
105
+ filtered_df=select_columns(filtered_df,open_query)
106
  filtered_df = filter_queries(query, filtered_df)
107
  # filtered_df = filtered_df[[map_columns[k] for k in columns]]
108
  # deduplication
 
131
 
132
  return filtered_df
133
 
134
+ def select_columns(df: pd.DataFrame, columns_1: list) -> pd.DataFrame:
135
+ always_here_cols = ['Unlearned_Methods','Source', 'Diffusion_Models']
136
+
137
+ # We use COLS to maintain sorting
138
+ all_columns =['Pre-ASR','Post-ASR','FID']
139
+
140
+ if (len(columns_1)) == 0:
141
+ filtered_df = df[
142
+ always_here_cols +
143
+ [c for c in all_columns if c in df.columns]
144
+ ]
145
+
146
+ else:
147
+ filtered_df = df[
148
+ always_here_cols +
149
+ [c for c in all_columns if c in df.columns and (c in columns_1) ]
150
+ ]
151
+
152
+ return filtered_df
153
+
154
+
155
  demo = gr.Blocks(css=custom_css)
156
  with demo:
157
  gr.HTML(TITLE)
 
233
  [
234
  # df_avg,
235
  hidden_leaderboard_table_for_search,
236
+ model1_column,
237
  # shown_columns,
238
  #type_query,
239
  open_query,
 
247
  )
248
 
249
  #for selector in [type_query, open_query]:
250
+ for selector in [open_query,model1_column]:
251
  selector.change(
252
  update_table,
253
  [
254
  # df_avg,
255
  hidden_leaderboard_table_for_search,
256
+ model1_column,
257
  # shown_columns,
258
  #type_query,
259
  open_query,