Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
248 |
-
|
249 |
-
|
250 |
-
mapper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|