Anton Bushuiev commited on
Commit
926bf18
·
1 Parent(s): c53be73

Fix test example downloading

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -18,15 +18,22 @@ from dreams.definitions import *
18
 
19
 
20
  def setup():
21
- # Download spectra library
22
- os.makedirs('./DreaMS/data', exist_ok=True)
 
23
  url = 'https://huggingface.co/datasets/roman-bushuiev/GeMS/resolve/main/data/auxiliary/MassSpecGym_DreaMS.hdf5'
24
- target_path = './DreaMS/data/MassSpecGym_DreaMS.hdf5'
25
- if not os.path.exists(target_path):
26
  urllib.request.urlretrieve(url, target_path)
27
 
28
  # Run simple example as a test and to download weights
29
- embs = dreams_embeddings('DreaMS/data/examples/example_5_spectra.mgf')
 
 
 
 
 
 
30
  print("Setup complete")
31
 
32
 
 
18
 
19
 
20
  def setup():
21
+ # Download spectral library
22
+ data_path = Path('./DreaMS/data')
23
+ data_path.mkdir(parents=True, exist_ok=True)
24
  url = 'https://huggingface.co/datasets/roman-bushuiev/GeMS/resolve/main/data/auxiliary/MassSpecGym_DreaMS.hdf5'
25
+ target_path = data_path / 'MassSpecGym_DreaMS.hdf5'
26
+ if not target_path.exists():
27
  urllib.request.urlretrieve(url, target_path)
28
 
29
  # Run simple example as a test and to download weights
30
+ # Download example spectra file
31
+ example_url = 'https://raw.githubusercontent.com/pluskal-lab/DreaMS/cc806fa6fea281c1e57dd81fc512f71de9290017/data/examples/example_5_spectra.mgf'
32
+ example_path = Path('./data/example_5_spectra.mgf')
33
+ example_path.parent.mkdir(parents=True, exist_ok=True)
34
+ if not example_path.exists():
35
+ urllib.request.urlretrieve(example_url, example_path)
36
+ embs = dreams_embeddings(example_path)
37
  print("Setup complete")
38
 
39