Ana Sanchez commited on
Commit
81dc1fb
1 Parent(s): 01a8b16
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -34,10 +34,10 @@ CLOOME_PATH = "/home/ana/gitrepos/hti-cloob"
34
  MODEL_PATH = os.path.join(datapath, "epoch_55.pt")
35
  npzs = os.path.join(datapath, "npzs")
36
  molecule_features = os.path.join(datapath, "all_molecule_cellpainting_features.pkl")
37
- mol_index = os.path.join(datapath, "cellpainting-unique-molecule.csv")
38
  image_features = os.path.join(datapath, "subset_image_cellpainting_features.pkl")
39
  images_arr = os.path.join(datapath, "subset_npzs_dict_.npz")
40
- img_index = os.path.join(datapath, "cellpainting-all-imgpermol.csv")
41
  imgname = "I1"
42
 
43
  device = "cuda" if torch.cuda.is_available() else "cpu"
@@ -376,7 +376,7 @@ def molecules_from_image():
376
  mol_features, mol_ids = main(mol_index, MODEL_PATH, model_type, mol_path=molpath, image_resolution=image_resolution)
377
  predefined_features = False
378
  else:
379
- mol_index = pd.read_csv(mol_index)
380
  mol_features_torch = torch.load(molecule_features, map_location=device)
381
  mol_features = mol_features_torch["mol_features"]
382
  mol_ids = mol_features_torch["mol_ids"]
@@ -458,7 +458,7 @@ def images_from_molecule():
458
  top_probs = torch.flatten(top_probs)
459
  top_labels = torch.flatten(top_labels)
460
 
461
- img_index = pd.read_csv(img_index)
462
  img_index.set_index(["SAMPLE_KEY"], inplace=True)
463
  top_ids = [img_ids[i] for i in top_labels]
464
 
 
34
  MODEL_PATH = os.path.join(datapath, "epoch_55.pt")
35
  npzs = os.path.join(datapath, "npzs")
36
  molecule_features = os.path.join(datapath, "all_molecule_cellpainting_features.pkl")
37
+ mol_index_file = os.path.join(datapath, "cellpainting-unique-molecule.csv")
38
  image_features = os.path.join(datapath, "subset_image_cellpainting_features.pkl")
39
  images_arr = os.path.join(datapath, "subset_npzs_dict_.npz")
40
+ img_index_file = os.path.join(datapath, "cellpainting-all-imgpermol.csv")
41
  imgname = "I1"
42
 
43
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
376
  mol_features, mol_ids = main(mol_index, MODEL_PATH, model_type, mol_path=molpath, image_resolution=image_resolution)
377
  predefined_features = False
378
  else:
379
+ mol_index = pd.read_csv(mol_index_file)
380
  mol_features_torch = torch.load(molecule_features, map_location=device)
381
  mol_features = mol_features_torch["mol_features"]
382
  mol_ids = mol_features_torch["mol_ids"]
 
458
  top_probs = torch.flatten(top_probs)
459
  top_labels = torch.flatten(top_labels)
460
 
461
+ img_index = pd.read_csv(img_index_files)
462
  img_index.set_index(["SAMPLE_KEY"], inplace=True)
463
  top_ids = [img_ids[i] for i in top_labels]
464