Sonja Topf commited on
Commit
40e74c5
·
1 Parent(s): f3582c7
Files changed (1) hide show
  1. predict.py +7 -7
predict.py CHANGED
@@ -37,7 +37,7 @@ def predict(smiles_list):
37
  print(f"Received {len(smiles_list)} SMILES strings")
38
 
39
  # put smiles into csv
40
- with open("./data/smiles_cleaned.csv", "w", newline="") as f:
41
  writer = csv.writer(f)
42
  writer.writerow(["smiles"]) # header
43
  for smi in clean_smiles:
@@ -45,9 +45,10 @@ def predict(smiles_list):
45
  # predict
46
  command = [
47
  "chemprop", "predict",
48
- "--test-path", "./data/smiles_cleaned.csv",
49
- "--model-path", "./checkpoints/best.pt",
50
- "--smiles-columns", "smiles"
 
51
  ]
52
 
53
  # Run the command
@@ -55,7 +56,7 @@ def predict(smiles_list):
55
 
56
  # create results dictionary from predictions
57
 
58
- csv_path = "preds.csv"
59
 
60
  predictions = {}
61
  with open(csv_path, "r", newline="") as f:
@@ -75,5 +76,4 @@ def predict(smiles_list):
75
  predictions[smi] = {t: 0.5 for t in TARGET_NAMES}
76
 
77
 
78
- return predictions
79
-
 
37
  print(f"Received {len(smiles_list)} SMILES strings")
38
 
39
  # put smiles into csv
40
+ with open("./data/smiles.csv", "w", newline="") as f:
41
  writer = csv.writer(f)
42
  writer.writerow(["smiles"]) # header
43
  for smi in clean_smiles:
 
45
  # predict
46
  command = [
47
  "chemprop", "predict",
48
+ "--test-path", "data/smiles.csv",
49
+ "--model-path", "checkpoints/best.pt",
50
+ "--smiles-columns", "smiles",
51
+ "--preds-path", "data/preds.csv"
52
  ]
53
 
54
  # Run the command
 
56
 
57
  # create results dictionary from predictions
58
 
59
+ csv_path = "./data/preds.csv"
60
 
61
  predictions = {}
62
  with open(csv_path, "r", newline="") as f:
 
76
  predictions[smi] = {t: 0.5 for t in TARGET_NAMES}
77
 
78
 
79
+ return predictions