Spaces:
Sleeping
Sleeping
Update cancer.py
Browse files
cancer.py
CHANGED
|
@@ -31,7 +31,7 @@ def preprocess_data(df):
|
|
| 31 |
]), categorical_features)
|
| 32 |
], remainder='passthrough')
|
| 33 |
|
| 34 |
-
|
| 35 |
y = df['Cancer_Present']
|
| 36 |
return train_test_split(x, y, test_size=0.2, random_state=23), preprocess
|
| 37 |
|
|
@@ -104,7 +104,7 @@ input_data = [[age, tumor_size, tumor_grade, symptoms_severity, smoking_history,
|
|
| 104 |
if st.button("Predict Cancer Presence"):
|
| 105 |
if 'trained_model' in st.session_state:
|
| 106 |
model = st.session_state['trained_model']
|
| 107 |
-
x_train = st.session_state['
|
| 108 |
|
| 109 |
# Prepare input data for prediction
|
| 110 |
input_df = pd.DataFrame(input_data, columns=x_train.columns)
|
|
|
|
| 31 |
]), categorical_features)
|
| 32 |
], remainder='passthrough')
|
| 33 |
|
| 34 |
+
x= df.drop('Cancer_Present', axis=1)
|
| 35 |
y = df['Cancer_Present']
|
| 36 |
return train_test_split(x, y, test_size=0.2, random_state=23), preprocess
|
| 37 |
|
|
|
|
| 104 |
if st.button("Predict Cancer Presence"):
|
| 105 |
if 'trained_model' in st.session_state:
|
| 106 |
model = st.session_state['trained_model']
|
| 107 |
+
x_train = st.session_state['x_train']
|
| 108 |
|
| 109 |
# Prepare input data for prediction
|
| 110 |
input_df = pd.DataFrame(input_data, columns=x_train.columns)
|