AndrewMaru commited on
Commit
f930536
·
verified ·
1 Parent(s): a3d30f7

Upload 5 files

Browse files
Files changed (5) hide show
  1. README.md +2 -0
  2. application.py +58 -0
  3. main.ipynb +0 -0
  4. model.pkl +3 -0
  5. requirements.txt +10 -0
README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # DATATHON_LUNG_CANCER
2
+ DATATHON_COMPETITION
application.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import joblib
4
+
5
+ model = joblib.load('model.pkl')
6
+
7
+ st.title('🫁 Lung Cancer Diagnosis')
8
+ st.write("Please fill out the following information to assess the likelihood of lung cancer.")
9
+
10
+ gender = st.selectbox('Gender', [0, 1], format_func=lambda x: "Female" if x == 0 else "Male")
11
+ age = st.number_input('Age', max_value=120, value=0)
12
+ smoking = st.selectbox('Smoking', ['Yes', 'No'])
13
+ yellow_fingers = st.selectbox('Yellow Fingers', ['Yes', 'No'])
14
+ anxiety = st.selectbox('Anxiety', ['Yes', 'No'])
15
+ peer_pressure = st.selectbox('Peer Pressure', ['Yes', 'No'])
16
+ chronic_disease = st.selectbox('Chronic Disease', ['Yes', 'No'])
17
+ fatigue = st.selectbox('Fatigue', ['Yes', 'No'])
18
+ allergy = st.selectbox('Allergy', ['Yes', 'No'])
19
+ wheezing = st.selectbox('Wheezing', ['Yes', 'No'])
20
+ alcohol = st.selectbox('Alcohol Consuming', ['Yes', 'No'])
21
+ coughing = st.selectbox('Coughing', ['Yes', 'No'])
22
+ shortness_of_breath = st.selectbox('Shortness of Breath', ['Yes', 'No'])
23
+ swallowing_difficulty = st.selectbox('Swallowing Difficulty', ['Yes', 'No'])
24
+ chest_pain = st.selectbox('Chest Pain', ['Yes', 'No'])
25
+
26
+ # Convert inputs to numerical (assuming 1 = Yes, 0 = No)
27
+ def binary_encode(value):
28
+ return 1 if value == 'Yes' else 0
29
+
30
+ data = pd.DataFrame([[
31
+ gender,
32
+ age,
33
+ binary_encode(smoking),
34
+ binary_encode(yellow_fingers),
35
+ binary_encode(anxiety),
36
+ binary_encode(peer_pressure),
37
+ binary_encode(chronic_disease),
38
+ binary_encode(fatigue),
39
+ binary_encode(allergy),
40
+ binary_encode(wheezing),
41
+ binary_encode(alcohol),
42
+ binary_encode(coughing),
43
+ binary_encode(shortness_of_breath),
44
+ binary_encode(swallowing_difficulty),
45
+ binary_encode(chest_pain)
46
+ ]], columns=[
47
+ 'GENDER', 'AGE', 'SMOKING', 'YELLOW_FINGERS', 'ANXIETY', 'PEER_PRESSURE',
48
+ 'CHRONIC DISEASE', 'FATIGUE', 'ALLERGY', 'WHEEZING', 'ALCOHOL CONSUMING',
49
+ 'COUGHING', 'SHORTNESS OF BREATH', 'SWALLOWING DIFFICULTY', 'CHEST PAIN'
50
+ ])
51
+
52
+ # Predict button
53
+ if st.button('Predict'):
54
+ prediction = model.predict(data)[0]
55
+ if prediction == 1:
56
+ st.error("⚠️ High risk of lung cancer. Please consult a doctor.")
57
+ else:
58
+ st.success("✅ No Lung Cancer.")
main.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7a60129ae21f0bef6a4ad88e7024627d4fc95d14ee3418fbcea67309dc5ea58
3
+ size 111839
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ numpy
2
+ pandas
3
+ scikit-learn
4
+ imbalanced-learn
5
+ xgboost
6
+ matplotlib
7
+ seaborn
8
+ joblib
9
+ streamlit
10
+ streamlit-js-eval