ubowang commited on
Commit
67f06d3
·
verified ·
1 Parent(s): 57912cf

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +11 -5
utils.py CHANGED
@@ -148,10 +148,16 @@ def refresh_data():
148
  def search_and_filter_models(df, query, min_size, max_size):
149
  if query:
150
  df = df[df['Models'].str.contains(query, case=False, na=False)]
 
 
 
 
 
 
 
 
151
 
152
- df = df[(df['Model Size(B)'] >= min_size) & (df['Model Size(B)'] <= max_size)]
153
-
154
- return df[COLUMN_NAMES]
155
 
156
 
157
  def search_models(df, query):
@@ -169,9 +175,9 @@ def get_size_range(df):
169
 
170
  def process_model_size(size):
171
  if size == 'unk':
172
- return 1000.0
173
  try:
174
  return float(size)
175
  except ValueError:
176
- return 1000.0
177
 
 
148
  def search_and_filter_models(df, query, min_size, max_size):
149
  if query:
150
  df = df[df['Models'].str.contains(query, case=False, na=False)]
151
+
152
+ numeric_mask = df['Model Size(B)'].apply(lambda x: isinstance(x, (int, float)))
153
+ size_filtered = df[numeric_mask &
154
+ (df['Model Size(B)'] >= min_size) &
155
+ (df['Model Size(B)'] <= max_size)]
156
+ unknown_entries = df[df['Model Size(B)'] == 'unknown']
157
+ return pd.concat([size_filtered, unknown_entries])[COLUMN_NAMES]
158
+ # df = df[(df['Model Size(B)'] >= min_size) & (df['Model Size(B)'] <= max_size)]
159
 
160
+ # return df[COLUMN_NAMES]
 
 
161
 
162
 
163
  def search_models(df, query):
 
175
 
176
  def process_model_size(size):
177
  if size == 'unk':
178
+ return 'unknown'
179
  try:
180
  return float(size)
181
  except ValueError:
182
+ return 'unknown'
183