Abubakari commited on
Commit
b5afe2a
·
1 Parent(s): b8e4b29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -25,6 +25,13 @@ def predict_sepsis(input_data):
25
  prediction = model.predict(input_scaled_df)[0]
26
  probabilities = model.predict_proba(input_scaled_df)[0]
27
  sepsis_status = "Positive" if prediction == 1 else "Negative"
 
 
 
 
 
 
 
28
 
29
  output_df = pd.DataFrame(input_data, columns=['PRG', 'PL', 'PR', 'SK', 'TS', 'M11', 'BD2', 'Age', 'Insurance'])
30
  output_df['Prediction'] = sepsis_status
@@ -104,7 +111,6 @@ def main():
104
  st.pyplot(fig)
105
 
106
  # Print feature importance
107
-
108
  if hasattr(model, 'coef_'):
109
  feature_importances = model.coef_[0]
110
  feature_names = ['PRG', 'PL', 'PR', 'SK', 'TS', 'M11', 'BD2', 'Age', 'Insurance']
@@ -129,11 +135,12 @@ def main():
129
  ha='center', va='bottom')
130
  st.pyplot(fig)
131
 
132
-
133
- #st.subheader('Feature Importance')
134
- #st.write(importance_df)
135
  else:
136
  st.write('Feature importance is not available for this model.')
137
 
 
 
 
 
138
  if __name__ == '__main__':
139
  main()
 
25
  prediction = model.predict(input_scaled_df)[0]
26
  probabilities = model.predict_proba(input_scaled_df)[0]
27
  sepsis_status = "Positive" if prediction == 1 else "Negative"
28
+
29
+ if prediction == 1:
30
+ status_icon = "✔" # Red 'X' icon for positive sepsis prediction
31
+ sepsis_explanation = "Sepsis is a life-threatening condition caused by an infection. A positive prediction suggests that the patient might be exhibiting sepsis symptoms and requires immediate medical attention."
32
+ else:
33
+ status_icon = "✘" # Green checkmark icon for negative sepsis prediction
34
+ sepsis_explanation = "Sepsis is a life-threatening condition caused by an infection. A negative prediction suggests that the patient is not currently exhibiting sepsis symptoms."
35
 
36
  output_df = pd.DataFrame(input_data, columns=['PRG', 'PL', 'PR', 'SK', 'TS', 'M11', 'BD2', 'Age', 'Insurance'])
37
  output_df['Prediction'] = sepsis_status
 
111
  st.pyplot(fig)
112
 
113
  # Print feature importance
 
114
  if hasattr(model, 'coef_'):
115
  feature_importances = model.coef_[0]
116
  feature_names = ['PRG', 'PL', 'PR', 'SK', 'TS', 'M11', 'BD2', 'Age', 'Insurance']
 
135
  ha='center', va='bottom')
136
  st.pyplot(fig)
137
 
 
 
 
138
  else:
139
  st.write('Feature importance is not available for this model.')
140
 
141
+ st.subheader('Sepsis Explanation')
142
+ st.markdown(f"{status_icon} {sepsis_explanation}")
143
+
144
+
145
  if __name__ == '__main__':
146
  main()