DevakiPHuggingface/CKD_prediction_system
0
1import streamlit as st
2import pickle
3import numpy as np
4
5# Load model
6model = pickle.load(open("model.pkl", "rb"))
7
8st.set_page_config(page_title="CKD Prediction", layout="wide")
9
10# ๐จ Styling
11st.markdown("""
12<style>
13body {
14 background-color: #f4f8fb;
15}
16h1 {
17 color: #1f77b4;
18}
19.section {
20 background-color: white;
21 padding: 20px;
22 border-radius: 12px;
23 box-shadow: 0px 0px 8px rgba(0,0,0,0.1);
24}
25</style>
26""", unsafe_allow_html=True)
27
28# ๐ฅ HEADER
29st.markdown("<h1 style='text-align:center;'>๐ฉบ CKD Prediction System</h1>", unsafe_allow_html=True)
30st.markdown("<p style='text-align:center; color:gray;'>AI-based Kidney Disease Detection Platform</p>", unsafe_allow_html=True)
31
32st.markdown("---")
33
34# ๐ LAYOUT
35left, center, right = st.columns([1,2,1])
36
37# ๐ผ๏ธ LEFT SIDE (Kidney + Medical Icons)
38with left:
39 st.image("https://cdn-icons-png.flaticon.com/512/2966/2966487.png", width=150)
40 st.caption("Kidney Health")
41
42 st.image("https://cdn-icons-png.flaticon.com/512/2966/2966334.png", width=120)
43 st.caption("Blood Pressure")
44
45# ๐ CENTER FORM
46with center:
47 st.markdown('<div class="section">', unsafe_allow_html=True)
48 st.markdown("### ๐งพ Patient Details")
49
50 col1, col2 = st.columns(2)
51
52 with col1:
53 age = st.number_input("Age", 1, 100)
54 bp = st.number_input("Blood Pressure")
55 sg = st.number_input("Specific Gravity")
56 al = st.number_input("Albumin")
57 su = st.number_input("Sugar")
58
59 with col2:
60 hemo = st.number_input("Hemoglobin")
61 pcv = st.number_input("Packed Cell Volume")
62 wc = st.number_input("WBC Count")
63 rc = st.number_input("RBC Count")
64
65 st.markdown("<br>", unsafe_allow_html=True)
66
67 if st.button("๐ Predict", use_container_width=True):
68 features = np.array([[age, bp, sg, al, su, hemo, pcv, wc, rc]])
69 prediction = model.predict(features)
70
71 st.markdown("---")
72
73 if prediction[0] == 0:
74 st.error("โ ๏ธ Chronic Kidney Disease Detected")
75
76 st.markdown("### ๐ Recommended Care")
77 st.markdown("""
78 <div style="background-color:#ffe6e6; padding:15px; border-radius:10px;">
79 โ Reduce salt intake<br>
80 โ Control blood pressure<br>
81 โ Drink water as advised<br>
82 โ Avoid processed foods<br>
83 โ Regular doctor consultation<br>
84 โ Monitor kidney function<br>
85 </div>
86 """, unsafe_allow_html=True)
87
88 else:
89 st.success("โ
No Kidney Disease Detected")
90
91 st.markdown("### ๐ฟ Healthy Lifestyle Tips")
92 st.markdown("""
93 <div style="background-color:#e6ffe6; padding:15px; border-radius:10px;">
94 โ Stay hydrated<br>
95 โ Balanced diet<br>
96 โ Exercise regularly<br>
97 โ Avoid excess salt<br>
98 โ Routine health checkups<br>
99 </div>
100 """, unsafe_allow_html=True)
101
102 st.markdown('</div>', unsafe_allow_html=True)
103
104# ๐ฅ RIGHT SIDE (Hospital + Health Icons)
105with right:
106 st.image("https://cdn-icons-png.flaticon.com/512/3209/3209265.png", width=150)
107 st.caption("Hospital Care")
108
109 st.image("https://cdn-icons-png.flaticon.com/512/387/387561.png", width=120)
110 st.caption("Healthcare Monitoring")
111
112# Footer
113st.markdown("---")
114st.markdown("<p style='text-align:center; color:gray;'>๐ฅ CKD ML Project | Smart Healthcare System</p>", unsafe_allow_html=True)