File size: 1,119 Bytes
218cbeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import joblib
import numpy as np

# Load model
model = joblib.load("model.pkl")

st.set_page_config(page_title="Gestational Diabetes Prediction")

st.title("🩺 Gestational Diabetes Prediction")
st.write("Enter patient details below:")

# Inputs
BMI = st.number_input("Body Mass Index (BMI)", min_value=0.0)
Parity = st.number_input("Parity", min_value=0)
Gravida = st.number_input("Gravida", min_value=0)
Glucose0 = st.number_input("Glucose Level at 0 min")
Glucose120 = st.number_input("Glucose Level at 120 min")
Systolic = st.number_input("Systolic Blood Pressure")
Diastolic = st.number_input("Diastolic Blood Pressure")

if st.button("Predict"):

    input_data = np.array([[ 
        BMI, Parity, Gravida,
        Glucose0, Glucose120,
        Systolic, Diastolic
    ]])

    prediction = model.predict(input_data)[0]
    probability = model.predict_proba(input_data)[0][1] * 100

    if prediction == 1:
        st.error(f"⚠ High Risk of Gestational Diabetes")
    else:
        st.success(f"✅ Low Risk of Gestational Diabetes")

    st.info(f"Probability: {round(probability,2)}%")