Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,6 @@ import pandas as pd
|
|
4 |
import numpy as np
|
5 |
|
6 |
# Page Title with Style
|
7 |
-
# st.title("๐ฉธ Sepsis Prediction App")
|
8 |
-
# Page Title with Style (Centered)
|
9 |
st.markdown(
|
10 |
f"""
|
11 |
<div style="text-align: center;">
|
@@ -125,7 +123,12 @@ if st.button("๐ฎ Predict Sepsis"):
|
|
125 |
try:
|
126 |
input_data_scaled_df = preprocess_input_data(input_data)
|
127 |
sepsis_status = make_predictions(input_data_scaled_df)
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
# Add the sepsis prediction to the input DataFrame
|
131 |
input_data['Sepsis'] = sepsis_status
|
@@ -133,12 +136,29 @@ if st.button("๐ฎ Predict Sepsis"):
|
|
133 |
# Convert the input data to a pandas DataFrame
|
134 |
input_df = pd.DataFrame([input_data])
|
135 |
|
136 |
-
# Display the DataFrame
|
|
|
137 |
st.table(input_df)
|
138 |
|
139 |
except Exception as e:
|
140 |
st.error(f"An error occurred: {e}")
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
# Display Data Fields and Descriptions
|
143 |
st.sidebar.title("๐ Data Fields")
|
144 |
for field, description in data_fields.items():
|
|
|
4 |
import numpy as np
|
5 |
|
6 |
# Page Title with Style
|
|
|
|
|
7 |
st.markdown(
|
8 |
f"""
|
9 |
<div style="text-align: center;">
|
|
|
123 |
try:
|
124 |
input_data_scaled_df = preprocess_input_data(input_data)
|
125 |
sepsis_status = make_predictions(input_data_scaled_df)
|
126 |
+
|
127 |
+
# Display the sepsis prediction
|
128 |
+
if sepsis_status == 'Negative':
|
129 |
+
st.success(f"The predicted sepsis status is: {sepsis_status}")
|
130 |
+
elif sepsis_status == 'Positive':
|
131 |
+
st.error(f"The predicted sepsis status is: {sepsis_status}")
|
132 |
|
133 |
# Add the sepsis prediction to the input DataFrame
|
134 |
input_data['Sepsis'] = sepsis_status
|
|
|
136 |
# Convert the input data to a pandas DataFrame
|
137 |
input_df = pd.DataFrame([input_data])
|
138 |
|
139 |
+
# Display the input DataFrame
|
140 |
+
st.markdown("### Input Data with Sepsis Prediction")
|
141 |
st.table(input_df)
|
142 |
|
143 |
except Exception as e:
|
144 |
st.error(f"An error occurred: {e}")
|
145 |
|
146 |
+
# Predict Button with Style
|
147 |
+
if st.button("๐ฎ Predict Sepsis"):
|
148 |
+
try:
|
149 |
+
input_data_scaled_df = preprocess_input_data(input_data)
|
150 |
+
sepsis_status = make_predictions(input_data_scaled_df)
|
151 |
+
|
152 |
+
# Display output with color based on prediction
|
153 |
+
if sepsis_status == 'Negative':
|
154 |
+
st.success(f"The predicted sepsis status is: {sepsis_status}")
|
155 |
+
elif sepsis_status == 'Positive':
|
156 |
+
st.error(f"The predicted sepsis status is: {sepsis_status}")
|
157 |
+
|
158 |
+
except Exception as e:
|
159 |
+
st.error(f"An error occurred: {e}")
|
160 |
+
|
161 |
+
|
162 |
# Display Data Fields and Descriptions
|
163 |
st.sidebar.title("๐ Data Fields")
|
164 |
for field, description in data_fields.items():
|