Spaces:
Sleeping
Sleeping
Download app.py from ml4genomics/GDM_pred: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/ml4genomics/GDM_pred/resolve/main/app.py
- Command line
-
hf download hf://spaces/ml4genomics/GDM_pred/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ml4genomics/GDM_pred/resolve/main/app.py
1.12 kB
| 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)}%") |