FinancialSupport commited on
Commit
b4df543
โ€ข
1 Parent(s): 915c386

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -31
app.py CHANGED
@@ -112,50 +112,49 @@ def filter_queries(query: str, filtered_df: pd.DataFrame) -> pd.DataFrame:
112
  return filtered_df
113
 
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  def filter_models(
116
- df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
117
  ) -> pd.DataFrame:
118
  # Show all models
119
  if show_deleted:
120
- filtered_df = df
121
  else: # Show only still on the hub models
122
- filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
123
 
124
  type_emoji = [t[0] for t in type_query]
125
- filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
126
- filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
127
 
128
  numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
129
- params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
130
  mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
131
- filtered_df = filtered_df.loc[mask]
132
-
133
- return filtered_df
134
-
135
- # def filter_models(
136
- # df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool, italian_only: bool
137
- # ) -> pd.DataFrame:
138
- # # Show all models
139
- # if show_deleted:
140
- # filtered_df = df.copy()
141
- # else: # Show only still on the hub models
142
- # filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True].copy()
143
 
144
- # filtered_df[AutoEvalColumn.model.name] = filtered_df[AutoEvalColumn.model.name].apply(lambda x: x.split('>')[-2].split('<')[0] if '<a' in x else x)
 
145
 
146
- # type_emoji = [t[0] for t in type_query]
147
- # filtered_df = filtered_df[filtered_df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
148
- # filtered_df = filtered_df[filtered_df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
149
-
150
- # numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
151
- # params_column = pd.to_numeric(filtered_df[AutoEvalColumn.params.name], errors="coerce")
152
- # mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
153
- # filtered_df = filtered_df[mask]
154
-
155
- # if italian_only:
156
- # filtered_df = filtered_df[filtered_df[AutoEvalColumn.author.name] == "๐Ÿ‡ฎ๐Ÿ‡น"]
157
 
158
- # return filtered_df
159
 
160
  def get_data_totale():
161
  dataset = pd.read_csv("mmlu_pro_it.csv", sep=',')
 
112
  return filtered_df
113
 
114
 
115
+ # def filter_models(
116
+ # df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool
117
+ # ) -> pd.DataFrame:
118
+ # # Show all models
119
+ # if show_deleted:
120
+ # filtered_df = df
121
+ # else: # Show only still on the hub models
122
+ # filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True]
123
+
124
+ # type_emoji = [t[0] for t in type_query]
125
+ # filtered_df = filtered_df.loc[df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
126
+ # filtered_df = filtered_df.loc[df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
127
+
128
+ # numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
129
+ # params_column = pd.to_numeric(df[AutoEvalColumn.params.name], errors="coerce")
130
+ # mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
131
+ # filtered_df = filtered_df.loc[mask]
132
+
133
+ # return filtered_df
134
+
135
  def filter_models(
136
+ df: pd.DataFrame, type_query: list, size_query: list, precision_query: list, show_deleted: bool, italian_only: bool
137
  ) -> pd.DataFrame:
138
  # Show all models
139
  if show_deleted:
140
+ filtered_df = df.copy()
141
  else: # Show only still on the hub models
142
+ filtered_df = df[df[AutoEvalColumn.still_on_hub.name] == True].copy()
143
 
144
  type_emoji = [t[0] for t in type_query]
145
+ filtered_df = filtered_df[filtered_df[AutoEvalColumn.model_type_symbol.name].isin(type_emoji)]
146
+ filtered_df = filtered_df[filtered_df[AutoEvalColumn.precision.name].isin(precision_query + ["None"])]
147
 
148
  numeric_interval = pd.IntervalIndex(sorted([NUMERIC_INTERVALS[s] for s in size_query]))
149
+ params_column = pd.to_numeric(filtered_df[AutoEvalColumn.params.name], errors="coerce")
150
  mask = params_column.apply(lambda x: any(numeric_interval.contains(x)))
151
+ filtered_df = filtered_df[mask]
 
 
 
 
 
 
 
 
 
 
 
152
 
153
+ if italian_only:
154
+ filtered_df = filtered_df[filtered_df[AutoEvalColumn.author.name] == "๐Ÿ‡ฎ๐Ÿ‡น"]
155
 
156
+ return filtered_df
 
 
 
 
 
 
 
 
 
 
157
 
 
158
 
159
  def get_data_totale():
160
  dataset = pd.read_csv("mmlu_pro_it.csv", sep=',')