pranit144 commited on
Commit
00b1e78
·
verified ·
1 Parent(s): 57a4e51

Upload 11 files

Browse files
app.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request, flash, redirect, url_for
2
+ import numpy as np
3
+ import pickle
4
+
5
+ app = Flask(__name__)
6
+ app.secret_key = 'your_secret_key_here' # Replace with a strong secret key
7
+
8
+ def predict_disease(patient_data):
9
+ """
10
+ Predicts disease risks based on patient data.
11
+ Loads pre-trained models and scalers, prepares features, and returns a risk dictionary.
12
+ """
13
+ try:
14
+ # Load models
15
+ heart_model = pickle.load(open('heart_rf_model.pkl', 'rb'))
16
+ diabetes_model = pickle.load(open('diabetes_model.pkl', 'rb'))
17
+ cirrhosis_model = pickle.load(open('cirrhosis_model.pkl', 'rb'))
18
+ hep_c_model = pickle.load(open('hep_c_model.pkl', 'rb'))
19
+
20
+ # Load scalers
21
+ heart_scaler = pickle.load(open('heart_scaler.pkl', 'rb'))
22
+ diabetes_scaler = pickle.load(open('diabetes_scaler.pkl', 'rb'))
23
+ cirrhosis_scaler = pickle.load(open('cirrhosis_scaler.pkl', 'rb'))
24
+ hep_c_scaler = pickle.load(open('hep_c_scaler.pkl', 'rb'))
25
+
26
+ # Heart Disease Features
27
+ heart_features = np.array([[
28
+ patient_data.get('Age', 55),
29
+ patient_data.get('Sex', 1),
30
+ patient_data.get('cp', 0),
31
+ patient_data.get('BP', 130),
32
+ patient_data.get('Cholesterol', 200),
33
+ patient_data.get('FBS', 0),
34
+ patient_data.get('EKG', 0),
35
+ patient_data.get('MaxHR', 150),
36
+ patient_data.get('ExerciseAngina', 0),
37
+ patient_data.get('STdepression', 0.0),
38
+ patient_data.get('STslope', 0),
39
+ patient_data.get('Vessels', 0),
40
+ patient_data.get('Thallium', 2)
41
+ ]])
42
+
43
+ # Diabetes Features – only scaling Age
44
+ diabetes_features = np.array([[
45
+ 1 if patient_data.get('Polyuria', 0) == 1 else 0,
46
+ 1 if patient_data.get('Polydipsia', 0) == 1 else 0,
47
+ patient_data.get('Age', 55), # Age will be scaled
48
+ 1 if patient_data.get('Gender', 'Male') == 'Male' else 0,
49
+ 1 if patient_data.get('partial_paresis', 0) == 1 else 0,
50
+ 1 if patient_data.get('sudden_weight_loss', 0) == 1 else 0,
51
+ 1 if patient_data.get('Irritability', 0) == 1 else 0,
52
+ 1 if patient_data.get('delayed_healing', 0) == 1 else 0,
53
+ 1 if patient_data.get('Alopecia', 0) == 1 else 0,
54
+ 1 if patient_data.get('Itching', 0) == 1 else 0
55
+ ]])
56
+ # Scale Age for diabetes
57
+ age_scaled = diabetes_scaler.transform([[patient_data.get('Age', 55)]])
58
+ diabetes_features[0, 2] = age_scaled[0, 0]
59
+
60
+ # Cirrhosis Features
61
+ cirrhosis_features = np.array([[
62
+ patient_data.get('Bilirubin', 1.2),
63
+ patient_data.get('Albumin', 3.8),
64
+ patient_data.get('Copper', 80),
65
+ patient_data.get('Alk_Phos', 70),
66
+ patient_data.get('SGOT', 40),
67
+ patient_data.get('Tryglicerides', 150),
68
+ patient_data.get('Platelets', 250),
69
+ patient_data.get('Prothrombin', 11),
70
+ patient_data.get('Stage', 1),
71
+ patient_data.get('Age', 55),
72
+ patient_data.get('Sex', 1),
73
+ patient_data.get('Ascites', 0),
74
+ patient_data.get('Hepatomegaly', 0),
75
+ patient_data.get('Spiders', 0),
76
+ patient_data.get('Edema', 0)
77
+ ]])
78
+
79
+ # Hepatitis C Features
80
+ hep_c_features = np.array([[
81
+ patient_data.get('Age', 55),
82
+ patient_data.get('Sex', 1),
83
+ patient_data.get('ALB', 4.0),
84
+ patient_data.get('ALP', 70),
85
+ patient_data.get('ALT', 45),
86
+ patient_data.get('AST', 38),
87
+ patient_data.get('BIL', 0.8),
88
+ patient_data.get('CHE', 8000),
89
+ patient_data.get('CHOL', 180),
90
+ patient_data.get('CREA', 0.9),
91
+ patient_data.get('GGT', 30),
92
+ patient_data.get('PROT', 7.0)
93
+ ]])
94
+
95
+ # Scale features
96
+ heart_scaled = heart_scaler.transform(heart_features)
97
+ cirrhosis_scaled = cirrhosis_scaler.transform(cirrhosis_features)
98
+ hep_c_scaled = hep_c_scaler.transform(hep_c_features)
99
+
100
+ # Get prediction probabilities
101
+ heart_prob = heart_model.predict_proba(heart_scaled)[:, 1][0]
102
+ diabetes_prob = diabetes_model.predict_proba(diabetes_features)[:, 1][0]
103
+ cirrhosis_prob = cirrhosis_model.predict_proba(cirrhosis_scaled)[:, 1][0]
104
+ hep_c_prob = hep_c_model.predict_proba(hep_c_scaled)[:, 1][0]
105
+
106
+ # Compute overall risk score
107
+ final_score = (
108
+ (0.30 * heart_prob) +
109
+ (0.25 * diabetes_prob) +
110
+ (0.25 * cirrhosis_prob) +
111
+ (0.20 * hep_c_prob)
112
+ )
113
+
114
+ return {
115
+ 'Heart Disease': {'Risk': 'High' if heart_prob > 0.5 else 'Low', 'Probability': round(heart_prob, 3)},
116
+ 'Diabetes': {'Risk': 'High' if diabetes_prob > 0.5 else 'Low', 'Probability': round(diabetes_prob, 3)},
117
+ 'Cirrhosis': {'Risk': 'High' if cirrhosis_prob > 0.5 else 'Low', 'Probability': round(cirrhosis_prob, 3)},
118
+ 'Hepatitis C': {'Risk': 'High' if hep_c_prob > 0.5 else 'Low', 'Probability': round(hep_c_prob, 3)},
119
+ 'Overall Risk Score': round(final_score, 3)
120
+ }
121
+
122
+ except Exception as e:
123
+ raise Exception(f"Error in prediction: {str(e)}")
124
+
125
+ @app.route('/', methods=['GET', 'POST'])
126
+ def index():
127
+ result = None
128
+ if request.method == 'POST':
129
+ try:
130
+ # Collect input parameters from the form
131
+ patient_data = {
132
+ # General / Heart Disease
133
+ 'Age': int(request.form.get('Age', 55)),
134
+ 'Sex': int(request.form.get('Sex', 1)),
135
+ 'cp': int(request.form.get('cp', 0)),
136
+ 'BP': float(request.form.get('BP', 130)),
137
+ 'Cholesterol': float(request.form.get('Cholesterol', 200)),
138
+ 'FBS': int(request.form.get('FBS', 0)),
139
+ 'EKG': int(request.form.get('EKG', 0)),
140
+ 'MaxHR': int(request.form.get('MaxHR', 150)),
141
+ 'ExerciseAngina': int(request.form.get('ExerciseAngina', 0)),
142
+ 'STdepression': float(request.form.get('STdepression', 0.0)),
143
+ 'STslope': int(request.form.get('STslope', 0)),
144
+ 'Vessels': int(request.form.get('Vessels', 0)),
145
+ 'Thallium': int(request.form.get('Thallium', 2)),
146
+
147
+ # Diabetes
148
+ 'Polyuria': int(request.form.get('Polyuria', 0)),
149
+ 'Polydipsia': int(request.form.get('Polydipsia', 0)),
150
+ 'Gender': request.form.get('Gender', 'Male'),
151
+ 'partial_paresis': int(request.form.get('partial_paresis', 0)),
152
+ 'sudden_weight_loss': int(request.form.get('sudden_weight_loss', 0)),
153
+ 'Irritability': int(request.form.get('Irritability', 0)),
154
+ 'delayed_healing': int(request.form.get('delayed_healing', 0)),
155
+ 'Alopecia': int(request.form.get('Alopecia', 0)),
156
+ 'Itching': int(request.form.get('Itching', 0)),
157
+
158
+ # Cirrhosis
159
+ 'Bilirubin': float(request.form.get('Bilirubin', 1.2)),
160
+ 'Albumin': float(request.form.get('Albumin', 3.8)),
161
+ 'Copper': float(request.form.get('Copper', 80)),
162
+ 'Alk_Phos': float(request.form.get('Alk_Phos', 70)),
163
+ 'SGOT': float(request.form.get('SGOT', 40)),
164
+ 'Tryglicerides': float(request.form.get('Tryglicerides', 150)),
165
+ 'Platelets': float(request.form.get('Platelets', 250)),
166
+ 'Prothrombin': float(request.form.get('Prothrombin', 11)),
167
+ 'Stage': int(request.form.get('Stage', 1)),
168
+ 'Ascites': int(request.form.get('Ascites', 0)),
169
+ 'Hepatomegaly': int(request.form.get('Hepatomegaly', 0)),
170
+ 'Spiders': int(request.form.get('Spiders', 0)),
171
+ 'Edema': int(request.form.get('Edema', 0)),
172
+
173
+ # Hepatitis C
174
+ 'ALB': float(request.form.get('ALB', 4.0)),
175
+ 'ALP': float(request.form.get('ALP', 70)),
176
+ 'ALT': float(request.form.get('ALT', 45)),
177
+ 'AST': float(request.form.get('AST', 38)),
178
+ 'BIL': float(request.form.get('BIL_hep', 0.8)), # To distinguish from cirrhosis bilirubin
179
+ 'CHE': float(request.form.get('CHE', 8000)),
180
+ 'CHOL': float(request.form.get('CHOL_hep', 180)), # To distinguish from heart cholesterol
181
+ 'CREA': float(request.form.get('CREA', 0.9)),
182
+ 'GGT': float(request.form.get('GGT', 30)),
183
+ 'PROT': float(request.form.get('PROT_hep', 7.0))
184
+ }
185
+
186
+ # Get the prediction result
187
+ result = predict_disease(patient_data)
188
+ except Exception as e:
189
+ flash(str(e))
190
+ return render_template('index.html', result=result)
191
+
192
+ if __name__ == '__main__':
193
+ app.run(debug=True, port=1234)
chd_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bda2cf8d2bbb1a2de14c7f4df6227b04be6085fe959a9a46c098021079d8d0e2
3
+ size 620304
cirrhosis_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f41586619726233b6a5828ee585e34defb55f8bbc29462b79fbb5583d310edad
3
+ size 50654
cirrhosis_scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:454799941712d0d757bbcdd9df04c2ce083195c864a8df48f74f3f9b076d2893
3
+ size 1046
diabetes_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13abf699fafcd7194b1e2695b23fba47fbbdbf311f998adeff06f6f3d1a0ee8f
3
+ size 669962
diabetes_scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2aa8f1134492222d92a98426e73c1be151969dfd6c3291f0ab8443bdd76d239
3
+ size 613
heart_rf_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bda2cf8d2bbb1a2de14c7f4df6227b04be6085fe959a9a46c098021079d8d0e2
3
+ size 620304
heart_scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87121f601efd875d54937ed7abe5af3666750c14a1dcf5307c705bd2106924ab
3
+ size 1020
hep_c_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b93332e20437a96e7f00969c4763ee24ce6e8c0de1aef91aebbc0e04480f5f27
3
+ size 356270
hep_c_scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1d6bfc3f1db929ce45cb91c81e5360c450a995d27ab6e3ef1f599b5b6620fb3
3
+ size 899
templates/index.html ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Disease Risk Prediction</title>
6
+ <style>
7
+ /* styles.css */
8
+
9
+ body {
10
+ font-family: Arial, sans-serif;
11
+ margin: 20px;
12
+ padding: 0;
13
+ background-color: #f2f2f2;
14
+ color: #333;
15
+ }
16
+
17
+ .container {
18
+ max-width: 900px;
19
+ margin: 0 auto;
20
+ background: #fff;
21
+ padding: 20px;
22
+ border-radius: 8px;
23
+ box-shadow: 0 0 10px rgba(0,0,0,0.1);
24
+ }
25
+
26
+ h1 {
27
+ text-align: center;
28
+ margin-bottom: 20px;
29
+ }
30
+
31
+ form {
32
+ margin-bottom: 20px;
33
+ }
34
+
35
+ fieldset {
36
+ border: 1px solid #ccc;
37
+ padding: 15px;
38
+ margin-bottom: 20px;
39
+ border-radius: 5px;
40
+ background: #fafafa;
41
+ }
42
+
43
+ legend {
44
+ font-weight: bold;
45
+ padding: 0 10px;
46
+ }
47
+
48
+ label {
49
+ display: inline-block;
50
+ width: 250px;
51
+ margin-bottom: 10px;
52
+ vertical-align: top;
53
+ }
54
+
55
+ input[type="number"],
56
+ input[type="text"] {
57
+ width: calc(100% - 260px);
58
+ padding: 8px;
59
+ margin-bottom: 10px;
60
+ border: 1px solid #ccc;
61
+ border-radius: 4px;
62
+ }
63
+
64
+ input[type="submit"] {
65
+ background-color: #4285f4;
66
+ color: #fff;
67
+ border: none;
68
+ padding: 10px 15px;
69
+ font-size: 16px;
70
+ border-radius: 5px;
71
+ cursor: pointer;
72
+ width: 100%;
73
+ }
74
+
75
+ input[type="submit"]:hover {
76
+ background-color: #357ae8;
77
+ }
78
+
79
+ .results {
80
+ background: #e9f5e9;
81
+ border: 1px solid #c3e6c3;
82
+ padding: 15px;
83
+ border-radius: 5px;
84
+ }
85
+
86
+ .results h2 {
87
+ margin-top: 0;
88
+ }
89
+
90
+ ul {
91
+ list-style: none;
92
+ padding: 0;
93
+ }
94
+
95
+ ul li {
96
+ margin-bottom: 10px;
97
+ }
98
+
99
+ </style>
100
+ </head>
101
+ <body>
102
+ <h1>Disease Risk Prediction</h1>
103
+
104
+ {% with messages = get_flashed_messages() %}
105
+ {% if messages %}
106
+ <ul style="color: red;">
107
+ {% for message in messages %}
108
+ <li>{{ message }}</li>
109
+ {% endfor %}
110
+ </ul>
111
+ {% endif %}
112
+ {% endwith %}
113
+
114
+ <form method="POST">
115
+ <!-- General / Heart Disease Information -->
116
+ <fieldset>
117
+ <legend>General &amp; Heart Disease Parameters</legend>
118
+ <label for="Age">Age:</label>
119
+ <input type="number" name="Age" id="Age" value="55" required><br>
120
+ <label for="Sex">Sex (1=Male, 0=Female):</label>
121
+ <input type="number" name="Sex" id="Sex" value="1" min="0" max="1" required><br>
122
+ <label for="cp">Chest Pain Type (cp):</label>
123
+ <input type="number" name="cp" id="cp" value="0"><br>
124
+ <label for="BP">Blood Pressure (BP):</label>
125
+ <input type="number" name="BP" id="BP" value="130"><br>
126
+ <label for="Cholesterol">Cholesterol:</label>
127
+ <input type="number" name="Cholesterol" id="Cholesterol" value="200"><br>
128
+ <label for="FBS">Fasting Blood Sugar (FBS):</label>
129
+ <input type="number" name="FBS" id="FBS" value="0"><br>
130
+ <label for="EKG">EKG:</label>
131
+ <input type="number" name="EKG" id="EKG" value="0"><br>
132
+ <label for="MaxHR">Max Heart Rate (MaxHR):</label>
133
+ <input type="number" name="MaxHR" id="MaxHR" value="150"><br>
134
+ <label for="ExerciseAngina">Exercise Angina (1=Yes,0=No):</label>
135
+ <input type="number" name="ExerciseAngina" id="ExerciseAngina" value="0" min="0" max="1"><br>
136
+ <label for="STdepression">ST Depression:</label>
137
+ <input type="number" step="0.1" name="STdepression" id="STdepression" value="0.0"><br>
138
+ <label for="STslope">ST Slope:</label>
139
+ <input type="number" name="STslope" id="STslope" value="0"><br>
140
+ <label for="Vessels">Number of Vessels:</label>
141
+ <input type="number" name="Vessels" id="Vessels" value="0"><br>
142
+ <label for="Thallium">Thallium:</label>
143
+ <input type="number" name="Thallium" id="Thallium" value="2">
144
+ </fieldset>
145
+
146
+ <!-- Diabetes Parameters -->
147
+ <fieldset>
148
+ <legend>Diabetes Parameters</legend>
149
+ <label for="Polyuria">Polyuria (1=Yes,0=No):</label>
150
+ <input type="number" name="Polyuria" id="Polyuria" value="0" min="0" max="1"><br>
151
+ <label for="Polydipsia">Polydipsia (1=Yes,0=No):</label>
152
+ <input type="number" name="Polydipsia" id="Polydipsia" value="0" min="0" max="1"><br>
153
+ <label for="Gender">Gender (Male/Female):</label>
154
+ <input type="text" name="Gender" id="Gender" value="Male"><br>
155
+ <label for="partial_paresis">Partial Paresis (1=Yes,0=No):</label>
156
+ <input type="number" name="partial_paresis" id="partial_paresis" value="0" min="0" max="1"><br>
157
+ <label for="sudden_weight_loss">Sudden Weight Loss (1=Yes,0=No):</label>
158
+ <input type="number" name="sudden_weight_loss" id="sudden_weight_loss" value="0" min="0" max="1"><br>
159
+ <label for="Irritability">Irritability (1=Yes,0=No):</label>
160
+ <input type="number" name="Irritability" id="Irritability" value="0" min="0" max="1"><br>
161
+ <label for="delayed_healing">Delayed Healing (1=Yes,0=No):</label>
162
+ <input type="number" name="delayed_healing" id="delayed_healing" value="0" min="0" max="1"><br>
163
+ <label for="Alopecia">Alopecia (1=Yes,0=No):</label>
164
+ <input type="number" name="Alopecia" id="Alopecia" value="0" min="0" max="1"><br>
165
+ <label for="Itching">Itching (1=Yes,0=No):</label>
166
+ <input type="number" name="Itching" id="Itching" value="0" min="0" max="1">
167
+ </fieldset>
168
+
169
+ <!-- Cirrhosis Parameters -->
170
+ <fieldset>
171
+ <legend>Cirrhosis Parameters</legend>
172
+ <label for="Bilirubin">Bilirubin:</label>
173
+ <input type="number" step="0.1" name="Bilirubin" id="Bilirubin" value="1.2"><br>
174
+ <label for="Albumin">Albumin:</label>
175
+ <input type="number" step="0.1" name="Albumin" id="Albumin" value="3.8"><br>
176
+ <label for="Copper">Copper:</label>
177
+ <input type="number" name="Copper" id="Copper" value="80"><br>
178
+ <label for="Alk_Phos">Alkaline Phosphatase (Alk_Phos):</label>
179
+ <input type="number" name="Alk_Phos" id="Alk_Phos" value="70"><br>
180
+ <label for="SGOT">SGOT:</label>
181
+ <input type="number" name="SGOT" id="SGOT" value="40"><br>
182
+ <label for="Tryglicerides">Tryglicerides:</label>
183
+ <input type="number" name="Tryglicerides" id="Tryglicerides" value="150"><br>
184
+ <label for="Platelets">Platelets:</label>
185
+ <input type="number" name="Platelets" id="Platelets" value="250"><br>
186
+ <label for="Prothrombin">Prothrombin:</label>
187
+ <input type="number" step="0.1" name="Prothrombin" id="Prothrombin" value="11"><br>
188
+ <label for="Stage">Stage:</label>
189
+ <input type="number" name="Stage" id="Stage" value="1"><br>
190
+ <label for="Ascites">Ascites (1=Yes,0=No):</label>
191
+ <input type="number" name="Ascites" id="Ascites" value="0" min="0" max="1"><br>
192
+ <label for="Hepatomegaly">Hepatomegaly (1=Yes,0=No):</label>
193
+ <input type="number" name="Hepatomegaly" id="Hepatomegaly" value="0" min="0" max="1"><br>
194
+ <label for="Spiders">Spiders (1=Yes,0=No):</label>
195
+ <input type="number" name="Spiders" id="Spiders" value="0" min="0" max="1"><br>
196
+ <label for="Edema">Edema (1=Yes,0=No):</label>
197
+ <input type="number" name="Edema" id="Edema" value="0" min="0" max="1">
198
+ </fieldset>
199
+
200
+ <!-- Hepatitis C Parameters -->
201
+ <fieldset>
202
+ <legend>Hepatitis C Parameters</legend>
203
+ <label for="ALB">ALB:</label>
204
+ <input type="number" step="0.1" name="ALB" id="ALB" value="4.0"><br>
205
+ <label for="ALP">ALP:</label>
206
+ <input type="number" name="ALP" id="ALP" value="70"><br>
207
+ <label for="ALT">ALT:</label>
208
+ <input type="number" name="ALT" id="ALT" value="45"><br>
209
+ <label for="AST">AST:</label>
210
+ <input type="number" name="AST" id="AST" value="38"><br>
211
+ <label for="BIL_hep">BIL (Hepatitis C):</label>
212
+ <input type="number" step="0.1" name="BIL_hep" id="BIL_hep" value="0.8"><br>
213
+ <label for="CHE">CHE:</label>
214
+ <input type="number" name="CHE" id="CHE" value="8000"><br>
215
+ <label for="CHOL_hep">CHOL (Hepatitis C):</label>
216
+ <input type="number" name="CHOL_hep" id="CHOL_hep" value="180"><br>
217
+ <label for="CREA">CREA:</label>
218
+ <input type="number" step="0.1" name="CREA" id="CREA" value="0.9"><br>
219
+ <label for="GGT">GGT:</label>
220
+ <input type="number" name="GGT" id="GGT" value="30"><br>
221
+ <label for="PROT_hep">PROT (Hepatitis C):</label>
222
+ <input type="number" step="0.1" name="PROT_hep" id="PROT_hep" value="7.0">
223
+ </fieldset>
224
+
225
+ <input type="submit" value="Predict">
226
+ </form>
227
+
228
+ {% if result %}
229
+ <div class="results">
230
+ <h2>Prediction Results</h2>
231
+ <ul>
232
+ {% for disease, info in result.items() %}
233
+ {% if disease != 'Overall Risk Score' %}
234
+ <li>
235
+ <strong>{{ disease }}:</strong>
236
+ Risk Level: {{ info.Risk }},
237
+ Probability: {{ (info.Probability * 100)|round(2) }}%
238
+ </li>
239
+ {% else %}
240
+ <li><strong>{{ disease }}:</strong> {{ (info * 100)|round(2) }}%</li>
241
+ {% endif %}
242
+ {% endfor %}
243
+ </ul>
244
+ </div>
245
+ {% endif %}
246
+
247
+ </body>
248
+ </html>