Vasumathi Varadararajan commited on
Commit
a7a31e5
·
1 Parent(s): 4c788ce

load cyp_models: accept -2 filename from HF uploader

Browse files
Files changed (1) hide show
  1. cyp_predict.py +11 -1
cyp_predict.py CHANGED
@@ -31,7 +31,17 @@ Held-out test AUC / AUPRC (this build):
31
  import os, functools
32
  import numpy as np
33
 
34
- _MODELS_PATH = os.path.join(os.path.dirname(__file__), "cyp_models.joblib")
 
 
 
 
 
 
 
 
 
 
35
 
36
  # thresholds (Q1: tiered bands, not a single cutoff)
37
  BAND_LIKELY = 0.70 # p >= 0.70 -> "likely inhibitor" (flag, moderate confidence)
 
31
  import os, functools
32
  import numpy as np
33
 
34
+ def _find_models_path():
35
+ """Locate the CYP model file. The HF uploader sometimes appends '-2', so we
36
+ accept either name (repo may carry cyp_models.joblib OR cyp_models-2.joblib)."""
37
+ here = os.path.dirname(__file__)
38
+ for name in ("cyp_models.joblib", "cyp_models-2.joblib"):
39
+ p = os.path.join(here, name)
40
+ if os.path.exists(p):
41
+ return p
42
+ return os.path.join(here, "cyp_models.joblib") # default (for clear error)
43
+
44
+ _MODELS_PATH = _find_models_path()
45
 
46
  # thresholds (Q1: tiered bands, not a single cutoff)
47
  BAND_LIKELY = 0.70 # p >= 0.70 -> "likely inhibitor" (flag, moderate confidence)