Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ def predict(gender, age, hypertension, heart_disease, ever_married, work_type, r
|
|
18 |
# Predict the stroke probability
|
19 |
prediction = model.predict_proba(input_df)[0][1]
|
20 |
# Return the prediction
|
21 |
-
result = "
|
22 |
return result
|
23 |
|
24 |
|
@@ -40,7 +40,7 @@ smoking_status = gr.inputs.Dropdown(
|
|
40 |
# Create the interface
|
41 |
inputs = [gender, age, hypertension, heart_disease, ever_married,
|
42 |
work_type, residence_type, avg_glucose_level, bmi, smoking_status]
|
43 |
-
outputs = gr.
|
44 |
|
45 |
# Launch the interface
|
46 |
demo = gr.Interface(fn=predict, inputs=inputs, outputs=outputs, title="Stroke Prediction",
|
|
|
18 |
# Predict the stroke probability
|
19 |
prediction = model.predict_proba(input_df)[0][1]
|
20 |
# Return the prediction
|
21 |
+
result = "{:.2f}%".format(prediction * 100) #to give a percentage
|
22 |
return result
|
23 |
|
24 |
|
|
|
40 |
# Create the interface
|
41 |
inputs = [gender, age, hypertension, heart_disease, ever_married,
|
42 |
work_type, residence_type, avg_glucose_level, bmi, smoking_status]
|
43 |
+
outputs = gr.outputs.Label(label='Result')
|
44 |
|
45 |
# Launch the interface
|
46 |
demo = gr.Interface(fn=predict, inputs=inputs, outputs=outputs, title="Stroke Prediction",
|