Spaces:
Sleeping
Sleeping
Update cancer.py
Browse files
cancer.py
CHANGED
|
@@ -59,7 +59,6 @@ def train_model(x_train, y_train, preprocess, model_name):
|
|
| 59 |
st.set_page_config(page_title='Cancer Prediction App', layout='wide')
|
| 60 |
|
| 61 |
with st.sidebar:
|
| 62 |
-
st.image('https://via.placeholder.com/300x150.png?text=Cancer+Prediction')
|
| 63 |
st.markdown("### Select Machine Learning Model")
|
| 64 |
model_name = st.radio("Choose a Model", ['Decision Tree', 'Logistic Regression', 'KNN', 'Random Forest', 'XGBoost'])
|
| 65 |
if st.button("Train Model"):
|
|
@@ -70,7 +69,7 @@ with st.sidebar:
|
|
| 70 |
# Train model
|
| 71 |
try:
|
| 72 |
model = train_model(x_train, y_train, preprocess, model_name)
|
| 73 |
-
accuracy = model.score(
|
| 74 |
st.session_state['trained_model'] = model
|
| 75 |
st.session_state['x_train_columns'] = x_train.columns # Save column names for future prediction
|
| 76 |
st.success(f"Model Trained Successfully! Accuracy: {accuracy:.2f}")
|
|
|
|
| 59 |
st.set_page_config(page_title='Cancer Prediction App', layout='wide')
|
| 60 |
|
| 61 |
with st.sidebar:
|
|
|
|
| 62 |
st.markdown("### Select Machine Learning Model")
|
| 63 |
model_name = st.radio("Choose a Model", ['Decision Tree', 'Logistic Regression', 'KNN', 'Random Forest', 'XGBoost'])
|
| 64 |
if st.button("Train Model"):
|
|
|
|
| 69 |
# Train model
|
| 70 |
try:
|
| 71 |
model = train_model(x_train, y_train, preprocess, model_name)
|
| 72 |
+
accuracy = model.score(x_test, y_test)
|
| 73 |
st.session_state['trained_model'] = model
|
| 74 |
st.session_state['x_train_columns'] = x_train.columns # Save column names for future prediction
|
| 75 |
st.success(f"Model Trained Successfully! Accuracy: {accuracy:.2f}")
|