hackerbyhobby commited on
Commit
d384299
·
unverified ·
1 Parent(s): 4e6936f

fixed something

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -21,9 +21,11 @@ def predict_heart_failure(input_data):
21
  # Predict class (0 or 1)
22
  prediction = "At Risk of Heart Failure" if probability >= 0.3 else "No Risk Detected"
23
 
 
24
  return {
25
  "Prediction": prediction,
26
- "Risk Probability": round(probability, 4)
 
27
  }
28
  except Exception as e:
29
  return {"error": str(e)}
@@ -33,7 +35,7 @@ inputs = []
33
  for feature in features:
34
  inputs.append(gr.inputs.Textbox(label=feature, placeholder=f"Enter value for {feature}"))
35
 
36
- output = gr.outputs.JSON(label="Heart Failure Prediction")
37
 
38
  interface = gr.Interface(
39
  fn=predict_heart_failure,
 
21
  # Predict class (0 or 1)
22
  prediction = "At Risk of Heart Failure" if probability >= 0.3 else "No Risk Detected"
23
 
24
+ # Return prediction, probability, and user inputs
25
  return {
26
  "Prediction": prediction,
27
+ "Risk Probability": round(probability, 4),
28
+ "User Inputs": input_data
29
  }
30
  except Exception as e:
31
  return {"error": str(e)}
 
35
  for feature in features:
36
  inputs.append(gr.inputs.Textbox(label=feature, placeholder=f"Enter value for {feature}"))
37
 
38
+ output = gr.outputs.JSON(label="Heart Failure Prediction & Inputs")
39
 
40
  interface = gr.Interface(
41
  fn=predict_heart_failure,