Spaces:
Sleeping
Sleeping
Update cancer.py
Browse files
cancer.py
CHANGED
|
@@ -94,13 +94,15 @@ input_data = [[age, tumor_size, tumor_grade, symptoms_severity, smoking_history,
|
|
| 94 |
alcohol_consumption, exercise_frequency, gender, family_history]]
|
| 95 |
|
| 96 |
if st.button("Predict Cancer Presence"):
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
st.markdown(
|
|
|
|
| 104 |
else:
|
| 105 |
-
st.
|
|
|
|
| 106 |
|
|
|
|
| 94 |
alcohol_consumption, exercise_frequency, gender, family_history]]
|
| 95 |
|
| 96 |
if st.button("Predict Cancer Presence"):
|
| 97 |
+
input_df = pd.DataFrame(input_data, columns=X_train.columns)
|
| 98 |
+
input_transformed = model.named_steps['preprocessor'].transform(input_df)
|
| 99 |
+
prediction = model.named_steps['classifier'].predict(input_transformed)
|
| 100 |
+
|
| 101 |
+
# Display prediction with styled text and additional message
|
| 102 |
+
if prediction[0] == 1:
|
| 103 |
+
st.markdown("<h3 style='color: red;'>Cancer Prediction: Positive 🟥</h3>", unsafe_allow_html=True)
|
| 104 |
+
st.write("Unfortunately, the model predicts the presence of cancer. Please consult a doctor for further advice.")
|
| 105 |
else:
|
| 106 |
+
st.markdown("<h3 style='color: green;'>Cancer Prediction: Negative 🟩</h3>", unsafe_allow_html=True)
|
| 107 |
+
st.write("Good news! The model predicts that there is no cancer detected. Stay healthy!")
|
| 108 |
|