File size: 2,822 Bytes
16b850e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import streamlit as st
import pandas as pd
import pickle

st.image(r"http://innomatics.in/wp-content/uploads/2023/01/innomatics-footer-logo.png")
st.title("Caners prediction using Machine learning")

df=pd.read_csv(r'cancer_prediction_data (2).csv')
df.dropna(inplace=True)

with open('model.pkl','rb') as file:
    model=pickle.load(file)




# AGE = st.number_input(
#     "Enter Age",
#     min_value=1,
#     max_value=100,
#     step=1
# )

# GENDER = st.selectbox(
#     "Select Gender",
#     df["Gender"].unique()
# )

# TUMOR_SIZE = st.number_input(
#     "Enter Tumor Size",
#     min_value=0.0
# )

# TUMOR_GRADE = st.selectbox(
#     "Select Tumor Grade",
#     df["Tumor_Grade"].unique()
# )

# SYMPTOM_SEVERITY = st.selectbox(
#     "Select Symptom Severity",
#     df["Symptoms_Severity"].unique()
# )

# FAMILY_HISTORY = st.selectbox(
#     "Family History",
#     df["Family_History"].unique()
# )

# SMOKING_HISTORY = st.selectbox(
#     "Smoking History",
#     df["Smoking_History"].unique()
# )

# ALCOHOL_CONSUMPTION = st.selectbox(
#     "Alcohol Consumption",
#     df["Alcohol_Consumption"].unique()
# )

# EXERCISE_FREQUENCY = st.selectbox(
#     "Exercise Frequency",
#     df["Exercise_Frequency"].unique()
# )

# input_data = pd.DataFrame([{
#     "Age": AGE,
#     "Gender": GENDER,
#     "Tumor_Size": TUMOR_SIZE,
#     "Tumor_Grade": TUMOR_GRADE,
#     "Symptoms_Severity": SYMPTOM_SEVERITY,
#     "Family_History": FAMILY_HISTORY,
#     "Smoking_History": SMOKING_HISTORY,
#     "Alcohol_Consumption": ALCOHOL_CONSUMPTION,
#     "Exercise_Frequency": EXERCISE_FREQUENCY
# }])


AGE = st.number_input("Enter The Age", min_value=1, max_value=100)
GENDER = st.selectbox('Enter the Gender', df['Gender'].unique())
TUMER_SIZE = st.number_input("ENter the Tumer Size")
TUMER_GRADE = st.selectbox('Enter the Tumar Grade', df['Tumor_Grade'].unique())
SYMPT_Severity = st.selectbox("Enter SYmptomp Severity", df['Symptoms_Severity'].unique())
FAMILY_HIST = st.selectbox('Enter the Family History', df['Family_History'].unique())
SMOKING_HIST = st.selectbox('Enter the smoking history', df['Smoking_History'].unique())
ALCOHOL = st.selectbox('Enter the Alocohol Consumption', df['Alcohol_Consumption'].unique())
EXERCISE = st.selectbox('Enter Exercise_Frequency', df['Exercise_Frequency'].unique())


input_data = pd.DataFrame([{
    "Age": AGE,
    "Gender": GENDER,
    "Tumor_Size": TUMER_SIZE,
    "Tumor_Grade": TUMER_GRADE,
    "Symptoms_Severity": SYMPT_Severity,
    "Family_History": FAMILY_HIST,
    "Smoking_History": SMOKING_HIST,
    "Alcohol_Consumption": ALCOHOL,
    "Exercise_Frequency": EXERCISE
}])


if st.button('predict'):
    result=model.predict(input_data)
    if result==0:
        st.write("Cancer is not diognised")
    else:
        st.write("Cancer is not diognised")