Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,28 +16,28 @@ def main():
|
|
16 |
st.title("Stroke Prediction")
|
17 |
|
18 |
with st.form("questionaire"):
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
|
29 |
# clicked==True only when the button is clicked
|
30 |
clicked = st.form_submit_button("Predict Stroke")
|
31 |
if clicked:
|
32 |
-
result=model.predict(pd.DataFrame({"Gender": [
|
33 |
-
"Age": [
|
34 |
-
"Hypertension": [
|
35 |
-
"Heart_Disease": [
|
36 |
-
"Work_type": [
|
37 |
-
"Residence": [
|
38 |
-
"Avg_Glucose_Level": [
|
39 |
-
"BMI": [
|
40 |
-
"Smoking": [
|
41 |
# Show prediction
|
42 |
result = 'Yes' if result[0] == 1 else 'No'
|
43 |
st.success("Your predicted Stroke is "+result)
|
|
|
16 |
st.title("Stroke Prediction")
|
17 |
|
18 |
with st.form("questionaire"):
|
19 |
+
gender = st.selectbox("Gender", options=unique_gender)
|
20 |
+
age = st.slider("Age", min_value=10, max_value=100)
|
21 |
+
hypertension = st.selectbox("Hypertension", options=unique_hypertension)
|
22 |
+
heart_disease = st.selectbox("Heart_Disease", options=unique_heart_disease)
|
23 |
+
work_type = st.selectbox("Work_type", options=unique_work_type)
|
24 |
+
residence = st.selectbox("Residence", options=unique_residence_type)
|
25 |
+
glucose_level = st.number_input("Glucose_Level")
|
26 |
+
bmi = st.number_input("BMI")
|
27 |
+
smoking = st.selectbox("Smoking", options=unique_smoking_status)
|
28 |
|
29 |
# clicked==True only when the button is clicked
|
30 |
clicked = st.form_submit_button("Predict Stroke")
|
31 |
if clicked:
|
32 |
+
result=model.predict(pd.DataFrame({"Gender": [gender],
|
33 |
+
"Age": [age],
|
34 |
+
"Hypertension": [hypertension],
|
35 |
+
"Heart_Disease": [heart_disease],
|
36 |
+
"Work_type": [work_type],
|
37 |
+
"Residence": [residence],
|
38 |
+
"Avg_Glucose_Level": [glucose_level],
|
39 |
+
"BMI": [bmi],
|
40 |
+
"Smoking": [smoking]}))
|
41 |
# Show prediction
|
42 |
result = 'Yes' if result[0] == 1 else 'No'
|
43 |
st.success("Your predicted Stroke is "+result)
|