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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -19,6 +19,7 @@ def preprocess_input_data(input_data):
19
 
20
  return input_scaled_df
21
 
 
22
  # Define a function to make the sepsis prediction
23
  def predict_sepsis(input_data):
24
  input_scaled_df = preprocess_input_data(input_data)
@@ -26,19 +27,15 @@ def predict_sepsis(input_data):
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
38
  output_df['Negative Probability'] = probabilities[0]
39
  output_df['Positive Probability'] = probabilities[1]
40
 
41
- return output_df, probabilities
42
 
43
  # Create a Streamlit app
44
  def main():
 
19
 
20
  return input_scaled_df
21
 
22
+
23
  # Define a function to make the sepsis prediction
24
  def predict_sepsis(input_data):
25
  input_scaled_df = preprocess_input_data(input_data)
 
27
  probabilities = model.predict_proba(input_scaled_df)[0]
28
  sepsis_status = "Positive" if prediction == 1 else "Negative"
29
 
30
+ status_icon = "✔" if prediction == 1 else "✘" # Red 'X' icon for positive sepsis prediction, green checkmark icon for negative 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." if prediction == 1 else "Sepsis is a life-threatening condition caused by an infection. A negative prediction suggests that the patient is not currently exhibiting sepsis symptoms."
 
 
 
 
32
 
33
  output_df = pd.DataFrame(input_data, columns=['PRG', 'PL', 'PR', 'SK', 'TS', 'M11', 'BD2', 'Age', 'Insurance'])
34
  output_df['Prediction'] = sepsis_status
35
  output_df['Negative Probability'] = probabilities[0]
36
  output_df['Positive Probability'] = probabilities[1]
37
 
38
+ return output_df, probabilities, status_icon, sepsis_explanation
39
 
40
  # Create a Streamlit app
41
  def main():