varshitha22 commited on
Commit
b4a2e0d
·
verified ·
1 Parent(s): d40cd97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -78,19 +78,21 @@ st.title("🎗️ Cancer Prediction Using Machine Learning 🎗️")
78
  st.markdown("""<style>.big-font {font-size:20px !important;}</style>
79
  <p class="big-font">Provide patient details below to predict cancer presence:</p>""", unsafe_allow_html=True)
80
 
 
81
  col1, col2 = st.columns(2)
 
82
  with col1:
83
- age = st.slider("Age", 18, 100, 30)
84
- tumor_size = st.slider("Tumor Size", 1.0, 10.0, 5.0)
85
- tumor_grade = st.selectbox("Tumor Grade", [1, 2, 3])
86
- symptoms_severity = st.selectbox("Symptoms Severity", [1, 2, 3])
87
 
88
  with col2:
89
- smoking_history = st.selectbox("Smoking History", [0, 1, 2])
90
- alcohol_consumption = st.selectbox("Alcohol Consumption", [0, 1, 2, 3])
91
- exercise_frequency = st.selectbox("Exercise Frequency", [0, 1, 2, 3])
92
- gender = st.selectbox("Gender", [0, 1])
93
- family_history = st.selectbox("Family History", [0, 1])
94
 
95
  input_data = [[age, tumor_size, tumor_grade, symptoms_severity, smoking_history,
96
  alcohol_consumption, exercise_frequency, gender, family_history]]
@@ -104,4 +106,4 @@ if st.button("Predict Cancer Presence"):
104
  prediction = model.named_steps['classifier'].predict(input_transformed)
105
  st.markdown(f"**Prediction Result: {'🟥 Positive' if prediction[0] == 1 else '🟩 Negative'}**")
106
  else:
107
- st.error("Please train a model first!")
 
78
  st.markdown("""<style>.big-font {font-size:20px !important;}</style>
79
  <p class="big-font">Provide patient details below to predict cancer presence:</p>""", unsafe_allow_html=True)
80
 
81
+ # Updated controls with radio buttons or buttons
82
  col1, col2 = st.columns(2)
83
+
84
  with col1:
85
+ age = st.radio("Age", [18, 20, 30, 40, 50, 60, 70, 80, 90, 100])
86
+ tumor_size = st.radio("Tumor Size", [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])
87
+ tumor_grade = st.radio("Tumor Grade", ['High', 'Low', 'Medium'])
88
+ symptoms_severity = st.radio("Symptoms Severity", ['Mild', 'Moderate', 'Severe'])
89
 
90
  with col2:
91
+ smoking_history = st.radio("Smoking History", ['Never Smoker', 'Former Smoker', 'Current Smoker'])
92
+ alcohol_consumption = st.radio("Alcohol Consumption", ['Low', 'Moderate', 'High'])
93
+ exercise_frequency = st.radio("Exercise Frequency", ['Rarely', 'Occasionally', 'Regularly', 'Never'])
94
+ gender = st.radio("Gender", ['Male', 'Female'])
95
+ family_history = st.radio("Family History", ["No", "Yes"])
96
 
97
  input_data = [[age, tumor_size, tumor_grade, symptoms_severity, smoking_history,
98
  alcohol_consumption, exercise_frequency, gender, family_history]]
 
106
  prediction = model.named_steps['classifier'].predict(input_transformed)
107
  st.markdown(f"**Prediction Result: {'🟥 Positive' if prediction[0] == 1 else '🟩 Negative'}**")
108
  else:
109
+ st.error("Please train a model first!")