m7n commited on
Commit
53c4d50
·
verified ·
1 Parent(s): 263890e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -19
app.py CHANGED
@@ -227,31 +227,29 @@ The Gradio app generates dynamic HTML files and stores them in a static director
227
 
228
 
229
 
230
-
231
  def setup_basemap_data():
232
  # get data.
233
  print("getting basemap data...")
234
- # basedata_file= requests.get(
235
- # "https://www.maxnoichl.eu/full/oa_project_on_scimap_background_data/100k_filtered_OA_sample_cluster_and_positions.bz"
236
- # )
237
- # Write the response content to a .bz file in the static directory
238
- # static_dir = Path("static")
239
- # static_dir.mkdir(exist_ok=True)
240
- # bz_file_name = "100k_filtered_OA_sample_cluster_and_positions.bz"
241
- # bz_file_path = static_dir / bz_file_name
242
- #
243
- # with open(bz_file_path, "wb") as f:
244
- # f.write(basedata_file.content)
245
- #
246
- # # Load the data from the saved .bz file
247
-
248
- basedata_df = load("100k_filtered_OA_sample_cluster_and_positions.bz")
249
- print(basedata_df.values.shape)
250
-
251
-
252
  return basedata_df
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  basedata_df = setup_basemap_data()
 
255
 
256
 
257
  # mount Gradio app to FastAPI app
 
227
 
228
 
229
 
 
230
  def setup_basemap_data():
231
  # get data.
232
  print("getting basemap data...")
233
+ basedata_df = load("300k_filtered_OA_sample_cluster_and_positions.bz")
234
+ print(basedata_df)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  return basedata_df
236
 
237
+ def setup_mapper():
238
+ # get data.
239
+ print("getting mapper...")
240
+
241
+ params_new = pickle.load(open('umap_mapper_100k_random_OA_specter_2_params.pkl', 'rb'))
242
+ print("setting up mapper...")
243
+ mapper = umap.UMAP()
244
+ mapper.set_params(**params_new.get('umap_params'))
245
+ for attr, value in params_new.get('umap_attributes').items():
246
+ mapper.__setattr__(attr, value)
247
+ mapper.__setattr__('embeddings_', List(params_new.get('umap_attributes').get('embedding_')))
248
+ return mapper
249
+
250
+
251
  basedata_df = setup_basemap_data()
252
+ mapper = setup_mapper()
253
 
254
 
255
  # mount Gradio app to FastAPI app