m7n commited on
Commit
4566fdb
·
verified ·
1 Parent(s): 595de7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -237,20 +237,31 @@ def setup_basemap_data():
237
  print(basedata_df)
238
  return basedata_df
239
 
 
 
240
  def setup_mapper():
241
- # get data.
242
  print("getting mapper...")
243
 
244
  params_new = pickle.load(open('umap_mapper_300k_random_OA_specter_2_params.pkl', 'rb'))
245
  print("setting up mapper...")
246
  mapper = umap.UMAP()
247
- mapper.set_params(**params_new.get('umap_params'))
248
- for attr, value in params_new.get('umap_attributes').items():
249
- mapper.__setattr__(attr, value)
250
- mapper.__setattr__('embeddings_', List(params_new.get('umap_attributes').get('embedding_')))
 
 
 
 
 
 
 
 
251
  return mapper
252
 
253
 
 
 
254
  basedata_df = setup_basemap_data()
255
  mapper = setup_mapper()
256
 
 
237
  print(basedata_df)
238
  return basedata_df
239
 
240
+
241
+
242
  def setup_mapper():
 
243
  print("getting mapper...")
244
 
245
  params_new = pickle.load(open('umap_mapper_300k_random_OA_specter_2_params.pkl', 'rb'))
246
  print("setting up mapper...")
247
  mapper = umap.UMAP()
248
+
249
+ # Filter out 'target_backend' from umap_params if it exists
250
+ umap_params = {k: v for k, v in params_new.get('umap_params', {}).items() if k != 'target_backend'}
251
+ mapper.set_params(**umap_params)
252
+
253
+ for attr, value in params_new.get('umap_attributes', {}).items():
254
+ if attr != 'embedding_':
255
+ setattr(mapper, attr, value)
256
+
257
+ if 'embedding_' in params_new.get('umap_attributes', {}):
258
+ mapper.embedding_ = List(params_new['umap_attributes']['embedding_'])
259
+
260
  return mapper
261
 
262
 
263
+
264
+
265
  basedata_df = setup_basemap_data()
266
  mapper = setup_mapper()
267