rasmodev commited on
Commit
318b7fb
ยท
1 Parent(s): fe6b71b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -9,7 +9,7 @@ st.markdown("---")
9
 
10
  # Welcome Message with Style
11
  st.write(
12
- "๐Ÿ‘‹ Welcome to the Sepsis Prediction App! Enter the medical data in the input fields below,"
13
  "click 'Predict Sepsis', and get the prediction result."
14
  )
15
 
@@ -25,7 +25,6 @@ with open('model_and_key_components.pkl', 'rb') as file:
25
  loaded_components = pickle.load(file)
26
 
27
  loaded_model = loaded_components['model']
28
- loaded_encoder = loaded_components['encoder']
29
  loaded_scaler = loaded_components['scaler']
30
 
31
  # Data Fields
@@ -40,12 +39,8 @@ data_fields = {
40
  "Age": "Age of the patient (years)"
41
  }
42
 
43
-
44
- # Sidebar with Data Fields
45
- st.title("๐Ÿ“Š Input Data")
46
- input_data = {}
47
- for field, description in data_fields.items():
48
- input_data[field] = st.number_input(description, value=0.0)
49
 
50
  # Function to preprocess input data
51
  def preprocess_input_data(input_data):
@@ -59,6 +54,19 @@ def make_predictions(input_data_scaled_df):
59
  sepsis_mapping = {0: 'Negative', 1: 'Positive'}
60
  return sepsis_mapping[y_pred[0]]
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  # Predict Button with Style
63
  if st.button("๐Ÿ”ฎ Predict Sepsis"):
64
  try:
 
9
 
10
  # Welcome Message with Style
11
  st.write(
12
+ "๐Ÿ‘‹ Welcome to the Sepsis Prediction App! Enter the medical data in the input fields below, "
13
  "click 'Predict Sepsis', and get the prediction result."
14
  )
15
 
 
25
  loaded_components = pickle.load(file)
26
 
27
  loaded_model = loaded_components['model']
 
28
  loaded_scaler = loaded_components['scaler']
29
 
30
  # Data Fields
 
39
  "Age": "Age of the patient (years)"
40
  }
41
 
42
+ # Organize input fields into two columns
43
+ col1, col2 = st.beta_columns(2)
 
 
 
 
44
 
45
  # Function to preprocess input data
46
  def preprocess_input_data(input_data):
 
54
  sepsis_mapping = {0: 'Negative', 1: 'Positive'}
55
  return sepsis_mapping[y_pred[0]]
56
 
57
+ # Input Data Fields in two columns
58
+ with col1:
59
+ input_data["PRG"] = st.number_input("Number of Pregnancies", value=0.0)
60
+ input_data["PL"] = st.number_input("Plasma Glucose Concentration (mg/dL)", value=0.0)
61
+ input_data["PR"] = st.number_input("Diastolic Blood Pressure (mm Hg)", value=0.0)
62
+ input_data["SK"] = st.number_input("Triceps Skinfold Thickness (mm)", value=0.0)
63
+
64
+ with col2:
65
+ input_data["TS"] = st.number_input("2-Hour Serum Insulin (mu U/ml)", value=0.0)
66
+ input_data["M11"] = st.number_input("Body Mass Index (BMI)", value=0.0)
67
+ input_data["BD2"] = st.number_input("Diabetes Pedigree Function (mu U/ml)", value=0.0)
68
+ input_data["Age"] = st.slider("Age of the patient (years)", 0, 100, 0)
69
+
70
  # Predict Button with Style
71
  if st.button("๐Ÿ”ฎ Predict Sepsis"):
72
  try: