Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,10 +12,10 @@ from sklearn.linear_model import LogisticRegression
|
|
| 12 |
from sklearn.neighbors import KNeighborsClassifier
|
| 13 |
|
| 14 |
# Set dark theme and page config
|
| 15 |
-
st.set_page_config(page_title="Cancer Prediction", page_icon="
|
| 16 |
st.markdown("""
|
| 17 |
<style>
|
| 18 |
-
body { background-color: #
|
| 19 |
.stButton>button { background-color: #ff4b4b; color: white; }
|
| 20 |
.stSelectbox, .stRadio, .stNumberInput, .stSlider { color: white; }
|
| 21 |
</style>
|
|
@@ -64,7 +64,6 @@ def train_model(X_train, y_train, preprocess, model_name):
|
|
| 64 |
'Logistic Regression': LogisticRegression(),
|
| 65 |
'KNN': KNeighborsClassifier()
|
| 66 |
}
|
| 67 |
-
|
| 68 |
model = models[model_name]
|
| 69 |
pipeline = Pipeline([
|
| 70 |
('preprocessor', preprocess),
|
|
@@ -105,7 +104,7 @@ family_history = st.radio("Family History", ['No', 'Yes'])
|
|
| 105 |
input_data = [[age, tumor_size, tumor_grade, symptoms_severity, smoking_history,
|
| 106 |
alcohol_consumption, exercise_frequency, gender, family_history]]
|
| 107 |
|
| 108 |
-
if st.button("🔮Predict Cancer Presence"):
|
| 109 |
if 'trained_model' in st.session_state:
|
| 110 |
model = st.session_state['trained_model']
|
| 111 |
input_df = pd.DataFrame(input_data, columns=X_train.columns)
|
|
@@ -114,5 +113,4 @@ if st.button("🔮Predict Cancer Presence"):
|
|
| 114 |
|
| 115 |
st.write("Cancer Prediction:", "✅ Positive" if prediction[0] == 1 else "❌ Negative")
|
| 116 |
else:
|
| 117 |
-
st.error("Please train a
|
| 118 |
-
|
|
|
|
| 12 |
from sklearn.neighbors import KNeighborsClassifier
|
| 13 |
|
| 14 |
# Set dark theme and page config
|
| 15 |
+
st.set_page_config(page_title="Cancer Prediction", page_icon="🩺", layout="centered")
|
| 16 |
st.markdown("""
|
| 17 |
<style>
|
| 18 |
+
body { background-color: #121212; color: white; }
|
| 19 |
.stButton>button { background-color: #ff4b4b; color: white; }
|
| 20 |
.stSelectbox, .stRadio, .stNumberInput, .stSlider { color: white; }
|
| 21 |
</style>
|
|
|
|
| 64 |
'Logistic Regression': LogisticRegression(),
|
| 65 |
'KNN': KNeighborsClassifier()
|
| 66 |
}
|
|
|
|
| 67 |
model = models[model_name]
|
| 68 |
pipeline = Pipeline([
|
| 69 |
('preprocessor', preprocess),
|
|
|
|
| 104 |
input_data = [[age, tumor_size, tumor_grade, symptoms_severity, smoking_history,
|
| 105 |
alcohol_consumption, exercise_frequency, gender, family_history]]
|
| 106 |
|
| 107 |
+
if st.button("🔮 Predict Cancer Presence"):
|
| 108 |
if 'trained_model' in st.session_state:
|
| 109 |
model = st.session_state['trained_model']
|
| 110 |
input_df = pd.DataFrame(input_data, columns=X_train.columns)
|
|
|
|
| 113 |
|
| 114 |
st.write("Cancer Prediction:", "✅ Positive" if prediction[0] == 1 else "❌ Negative")
|
| 115 |
else:
|
| 116 |
+
st.error("Please train a model first!")
|
|
|