Spaces:
Sleeping
Sleeping
File size: 1,121 Bytes
c7b4b0e 78bfb81 c7b4b0e 773db33 c7b4b0e 773db33 c7b4b0e 773db33 c7b4b0e a8e4c2f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
from keras.models import load_model
from graph import zeropad, zeropad_output_shape
from pathlib import Path
import joblib
def load_mitbih_model():
return load_model(
"src/MLII-latest.keras",
custom_objects={
"zeropad": zeropad,
"zeropad_output_shape": zeropad_output_shape
},
compile=False
)
def load_pcg_model():
model_path = Path("src/pcg_model.h5")
if not model_path.exists():
raise FileNotFoundError(f"PCG model not found at {model_path.resolve()}")
model = load_model(model_path, compile=False)
model.compile()
return model
def load_emg_model():
model_path = Path("src/emg_classifier_txt.h5")
if not model_path.exists():
raise FileNotFoundError(f"EMG model not found at {model_path.resolve()}")
model = load_model(model_path, compile=False)
model.compile()
return model
def load_vag_model():
p = Path("src/vag_feature_classifier.pkl")
if not p.exists():
raise FileNotFoundError(f"No VAG model at {p.resolve()}")
return joblib.load(p)
|