Spaces:
Sleeping
Sleeping
hackerbyhobby
commited on
so close, app updated
Browse files
app.py
CHANGED
|
@@ -39,7 +39,10 @@ def predict_outcome(*inputs):
|
|
| 39 |
|
| 40 |
# Predict using the model
|
| 41 |
prediction = rf_model.predict(input_df)[0]
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# Build Gradio interface
|
| 45 |
inputs = [
|
|
@@ -49,12 +52,17 @@ inputs = [
|
|
| 49 |
gr.Radio(radio_options, label=feature) for feature in categorical_features
|
| 50 |
]
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
interface = gr.Interface(
|
| 53 |
fn=predict_outcome,
|
| 54 |
inputs=inputs,
|
| 55 |
-
outputs=
|
| 56 |
-
title="Health Risk Prediction",
|
| 57 |
-
description="Predicts health risks based on input parameters using the trained model."
|
| 58 |
)
|
| 59 |
|
| 60 |
# Launch the app
|
|
|
|
| 39 |
|
| 40 |
# Predict using the model
|
| 41 |
prediction = rf_model.predict(input_df)[0]
|
| 42 |
+
prediction_label = "High Risk" if prediction == 1 else "Low Risk"
|
| 43 |
+
|
| 44 |
+
# Display input values for debugging
|
| 45 |
+
return prediction_label, input_data
|
| 46 |
|
| 47 |
# Build Gradio interface
|
| 48 |
inputs = [
|
|
|
|
| 52 |
gr.Radio(radio_options, label=feature) for feature in categorical_features
|
| 53 |
]
|
| 54 |
|
| 55 |
+
outputs = [
|
| 56 |
+
gr.Textbox(label="Prediction"),
|
| 57 |
+
gr.JSON(label="Input Values (Debugging)")
|
| 58 |
+
]
|
| 59 |
+
|
| 60 |
interface = gr.Interface(
|
| 61 |
fn=predict_outcome,
|
| 62 |
inputs=inputs,
|
| 63 |
+
outputs=outputs,
|
| 64 |
+
title="Health Risk Prediction with Debugging",
|
| 65 |
+
description="Predicts health risks based on input parameters using the trained model. Includes input values for debugging."
|
| 66 |
)
|
| 67 |
|
| 68 |
# Launch the app
|