| import skops.io as sio | |
| pipe = sio.load("./Model/drug_pipeline.skops", trusted=True) | |
| def predict_drug(age, sex, blood_pressure, cholesterol, na_to_k_ratio): | |
| """Predict drugs based on patient features. | |
| Args: | |
| age (int): Age of patient | |
| sex (str): Sex of patient | |
| blood_pressure (str): Blood pressure level | |
| cholesterol (str): Cholesterol level | |
| na_to_k_ratio (float): Ratio of sodium to potassium in blood | |
| Returns: | |
| str: Predicted drug label | |
| """ | |
| features = [age, sex, blood_pressure, cholesterol, na_to_k_ratio] | |
| predicted_drug = pipe.predict([features])[0] | |
| label = f"Predicted Drug: {predicted_drug}" | |
| return label |