shani67 commited on
Commit
16b850e
·
verified ·
1 Parent(s): bb8f943

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +107 -107
app.py CHANGED
@@ -1,107 +1,107 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import pickle
4
-
5
- st.image(r"http://innomatics.in/wp-content/uploads/2023/01/innomatics-footer-logo.png")
6
- st.title("Caners prediction using Machine learning")
7
-
8
- df=pd.read_csv(r'D:\cancer\cancer_prediction_data (2).csv')
9
- df.dropna(inplace=True)
10
-
11
- with open('model.pkl','rb') as file:
12
- model=pickle.load(file)
13
-
14
-
15
-
16
-
17
- # AGE = st.number_input(
18
- # "Enter Age",
19
- # min_value=1,
20
- # max_value=100,
21
- # step=1
22
- # )
23
-
24
- # GENDER = st.selectbox(
25
- # "Select Gender",
26
- # df["Gender"].unique()
27
- # )
28
-
29
- # TUMOR_SIZE = st.number_input(
30
- # "Enter Tumor Size",
31
- # min_value=0.0
32
- # )
33
-
34
- # TUMOR_GRADE = st.selectbox(
35
- # "Select Tumor Grade",
36
- # df["Tumor_Grade"].unique()
37
- # )
38
-
39
- # SYMPTOM_SEVERITY = st.selectbox(
40
- # "Select Symptom Severity",
41
- # df["Symptoms_Severity"].unique()
42
- # )
43
-
44
- # FAMILY_HISTORY = st.selectbox(
45
- # "Family History",
46
- # df["Family_History"].unique()
47
- # )
48
-
49
- # SMOKING_HISTORY = st.selectbox(
50
- # "Smoking History",
51
- # df["Smoking_History"].unique()
52
- # )
53
-
54
- # ALCOHOL_CONSUMPTION = st.selectbox(
55
- # "Alcohol Consumption",
56
- # df["Alcohol_Consumption"].unique()
57
- # )
58
-
59
- # EXERCISE_FREQUENCY = st.selectbox(
60
- # "Exercise Frequency",
61
- # df["Exercise_Frequency"].unique()
62
- # )
63
-
64
- # input_data = pd.DataFrame([{
65
- # "Age": AGE,
66
- # "Gender": GENDER,
67
- # "Tumor_Size": TUMOR_SIZE,
68
- # "Tumor_Grade": TUMOR_GRADE,
69
- # "Symptoms_Severity": SYMPTOM_SEVERITY,
70
- # "Family_History": FAMILY_HISTORY,
71
- # "Smoking_History": SMOKING_HISTORY,
72
- # "Alcohol_Consumption": ALCOHOL_CONSUMPTION,
73
- # "Exercise_Frequency": EXERCISE_FREQUENCY
74
- # }])
75
-
76
-
77
- AGE = st.number_input("Enter The Age", min_value=1, max_value=100)
78
- GENDER = st.selectbox('Enter the Gender', df['Gender'].unique())
79
- TUMER_SIZE = st.number_input("ENter the Tumer Size")
80
- TUMER_GRADE = st.selectbox('Enter the Tumar Grade', df['Tumor_Grade'].unique())
81
- SYMPT_Severity = st.selectbox("Enter SYmptomp Severity", df['Symptoms_Severity'].unique())
82
- FAMILY_HIST = st.selectbox('Enter the Family History', df['Family_History'].unique())
83
- SMOKING_HIST = st.selectbox('Enter the smoking history', df['Smoking_History'].unique())
84
- ALCOHOL = st.selectbox('Enter the Alocohol Consumption', df['Alcohol_Consumption'].unique())
85
- EXERCISE = st.selectbox('Enter Exercise_Frequency', df['Exercise_Frequency'].unique())
86
-
87
-
88
- input_data = pd.DataFrame([{
89
- "Age": AGE,
90
- "Gender": GENDER,
91
- "Tumor_Size": TUMER_SIZE,
92
- "Tumor_Grade": TUMER_GRADE,
93
- "Symptoms_Severity": SYMPT_Severity,
94
- "Family_History": FAMILY_HIST,
95
- "Smoking_History": SMOKING_HIST,
96
- "Alcohol_Consumption": ALCOHOL,
97
- "Exercise_Frequency": EXERCISE
98
- }])
99
-
100
-
101
- if st.button('predict'):
102
- result=model.predict(input_data)
103
- if result==0:
104
- st.write("Cancer is not diognised")
105
- else:
106
- st.write("Cancer is not diognised")
107
-
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import pickle
4
+
5
+ st.image(r"http://innomatics.in/wp-content/uploads/2023/01/innomatics-footer-logo.png")
6
+ st.title("Caners prediction using Machine learning")
7
+
8
+ df=pd.read_csv(r'cancer_prediction_data (2).csv')
9
+ df.dropna(inplace=True)
10
+
11
+ with open('model.pkl','rb') as file:
12
+ model=pickle.load(file)
13
+
14
+
15
+
16
+
17
+ # AGE = st.number_input(
18
+ # "Enter Age",
19
+ # min_value=1,
20
+ # max_value=100,
21
+ # step=1
22
+ # )
23
+
24
+ # GENDER = st.selectbox(
25
+ # "Select Gender",
26
+ # df["Gender"].unique()
27
+ # )
28
+
29
+ # TUMOR_SIZE = st.number_input(
30
+ # "Enter Tumor Size",
31
+ # min_value=0.0
32
+ # )
33
+
34
+ # TUMOR_GRADE = st.selectbox(
35
+ # "Select Tumor Grade",
36
+ # df["Tumor_Grade"].unique()
37
+ # )
38
+
39
+ # SYMPTOM_SEVERITY = st.selectbox(
40
+ # "Select Symptom Severity",
41
+ # df["Symptoms_Severity"].unique()
42
+ # )
43
+
44
+ # FAMILY_HISTORY = st.selectbox(
45
+ # "Family History",
46
+ # df["Family_History"].unique()
47
+ # )
48
+
49
+ # SMOKING_HISTORY = st.selectbox(
50
+ # "Smoking History",
51
+ # df["Smoking_History"].unique()
52
+ # )
53
+
54
+ # ALCOHOL_CONSUMPTION = st.selectbox(
55
+ # "Alcohol Consumption",
56
+ # df["Alcohol_Consumption"].unique()
57
+ # )
58
+
59
+ # EXERCISE_FREQUENCY = st.selectbox(
60
+ # "Exercise Frequency",
61
+ # df["Exercise_Frequency"].unique()
62
+ # )
63
+
64
+ # input_data = pd.DataFrame([{
65
+ # "Age": AGE,
66
+ # "Gender": GENDER,
67
+ # "Tumor_Size": TUMOR_SIZE,
68
+ # "Tumor_Grade": TUMOR_GRADE,
69
+ # "Symptoms_Severity": SYMPTOM_SEVERITY,
70
+ # "Family_History": FAMILY_HISTORY,
71
+ # "Smoking_History": SMOKING_HISTORY,
72
+ # "Alcohol_Consumption": ALCOHOL_CONSUMPTION,
73
+ # "Exercise_Frequency": EXERCISE_FREQUENCY
74
+ # }])
75
+
76
+
77
+ AGE = st.number_input("Enter The Age", min_value=1, max_value=100)
78
+ GENDER = st.selectbox('Enter the Gender', df['Gender'].unique())
79
+ TUMER_SIZE = st.number_input("ENter the Tumer Size")
80
+ TUMER_GRADE = st.selectbox('Enter the Tumar Grade', df['Tumor_Grade'].unique())
81
+ SYMPT_Severity = st.selectbox("Enter SYmptomp Severity", df['Symptoms_Severity'].unique())
82
+ FAMILY_HIST = st.selectbox('Enter the Family History', df['Family_History'].unique())
83
+ SMOKING_HIST = st.selectbox('Enter the smoking history', df['Smoking_History'].unique())
84
+ ALCOHOL = st.selectbox('Enter the Alocohol Consumption', df['Alcohol_Consumption'].unique())
85
+ EXERCISE = st.selectbox('Enter Exercise_Frequency', df['Exercise_Frequency'].unique())
86
+
87
+
88
+ input_data = pd.DataFrame([{
89
+ "Age": AGE,
90
+ "Gender": GENDER,
91
+ "Tumor_Size": TUMER_SIZE,
92
+ "Tumor_Grade": TUMER_GRADE,
93
+ "Symptoms_Severity": SYMPT_Severity,
94
+ "Family_History": FAMILY_HIST,
95
+ "Smoking_History": SMOKING_HIST,
96
+ "Alcohol_Consumption": ALCOHOL,
97
+ "Exercise_Frequency": EXERCISE
98
+ }])
99
+
100
+
101
+ if st.button('predict'):
102
+ result=model.predict(input_data)
103
+ if result==0:
104
+ st.write("Cancer is not diognised")
105
+ else:
106
+ st.write("Cancer is not diognised")
107
+