import streamlit as st import pandas as pd import joblib import numpy as np model = joblib.load("model/xgb_model.joblib") scaler = joblib.load("model/scaler.joblib") st.title("Hemoglobin Level Predictor") st.markdown( ''' ### Developed by Dr. Vinod Kumar Yata's research group School of Allied and Healthcare Sciences, Malla Reddy University, Hyderabad, India --- ⚠️ **Warning**: This is an experimental tool and should not be used for medical diagnosis. Always consult a licensed healthcare provider for medical advice. --- ''', unsafe_allow_html=True ) age = st.number_input("Age", min_value=0, max_value=120, value=30) gender = st.selectbox("Gender", options=["Male", "Female"]) o2_saturation = st.slider("O2 Saturation (%)", min_value=50.0, max_value=100.0, value=98.0) bp_systolic = st.number_input("Systolic BP", min_value=50, max_value=200, value=120) bp_diastolic = st.number_input("Diastolic BP", min_value=30, max_value=130, value=80) respiratory_rate = st.number_input("Respiratory Rate (breaths/min)", min_value=5, max_value=60, value=18) gender_num = 1 if gender == "Male" else 0 input_df = pd.DataFrame([{ "Age": age, "Gender": gender_num, "O2_Saturation": o2_saturation, "BP_Systolic": bp_systolic, "BP_Diastolic": bp_diastolic, "Respiratory_Rate": respiratory_rate }]) if st.button("Predict Hemoglobin Level"): input_scaled = scaler.transform(input_df) prediction = model.predict(input_scaled)[0] st.success(f"Predicted Hemoglobin Level: {prediction:.2f} g/dL")