Um124 commited on
Commit
726a211
1 Parent(s): a749b65

Intial Commit

Browse files
Lung_Cancer_Prediction.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import numpy as np
4
+ from joblib import load
5
+
6
+ def predict_Level(
7
+ Age, Gender, Air_Pollution, Alcohol_use,
8
+ Dust_Allergy, OccuPational_Hazards, Genetic_Risk,
9
+ chronic_Lung_Disease, Balanced_Diet, Obesity, Smoking,
10
+ Passive_Smoker, Chest_Pain, Coughing_of_Blood, Fatigue,
11
+ Weight_Loss, Shortness_of_Breath, Wheezing,Swallowing_Difficulty,
12
+ Clubbing_of_Finger_Nails, Frequent_Cold,Dry_Cough, Snoring
13
+ ):
14
+
15
+ # load model
16
+ model = load('Lung_cancer_prediction.joblib')
17
+
18
+ # Create a dict array from the parameters
19
+ data = {
20
+ 'Age': [Age],
21
+ 'Gender': [Gender],
22
+ 'Air Pollution': [Air_Pollution],
23
+ 'Alcohol use': [Alcohol_use],
24
+ 'Dust Allergy': [Dust_Allergy],
25
+ 'OccuPational Hazards': [OccuPational_Hazards],
26
+ 'Genetic Risk': [Genetic_Risk],
27
+ 'chronic Lung Disease': [chronic_Lung_Disease],
28
+ 'Balanced Diet': [Balanced_Diet],
29
+ 'Obesity': [Obesity],
30
+ 'Smoking': [Smoking],
31
+ 'Passive Smoker': [Passive_Smoker],
32
+ 'Chest Pain': [Chest_Pain],
33
+ 'Coughing of Blood': [Coughing_of_Blood],
34
+ 'Fatigue': [Fatigue],
35
+ 'Weight Loss': [Weight_Loss],
36
+ 'Shortness of Breath': [Shortness_of_Breath],
37
+ 'Wheezing': [Wheezing],
38
+ 'Swallowing Difficulty': [Swallowing_Difficulty],
39
+ 'Clubbing of Finger Nails': [Clubbing_of_Finger_Nails],
40
+ 'Frequent Cold': [Frequent_Cold],
41
+ 'Dry Cough': [Dry_Cough],
42
+ 'Snoring': [Snoring],
43
+ }
44
+ Xinp = pd.DataFrame(data)
45
+ print(Xinp)
46
+
47
+ # Predict the level
48
+ Level = model.predict(Xinp)
49
+
50
+ # return the level
51
+ return Level[0]
52
+
53
+ # Create the gradio interface
54
+
55
+ ui = gr.Interface(
56
+ fn = predict_Level,
57
+ inputs = [
58
+ gr.inputs.Textbox(placeholder='Age', default="33", numeric=True,label='Age'),
59
+ gr.inputs.Textbox(placeholder='Gender', default="1", numeric=True,label='Gender'),
60
+ gr.inputs.Textbox(placeholder='Air_Pollution', default="2",numeric=True,label='Air Pollution'),
61
+ gr.inputs.Textbox(placeholder='Alcohol_use', default="4",numeric=True,label='Alcohol use'),
62
+ gr.inputs.Textbox(placeholder='Dust_Allergy', default="5",numeric=True,label='Dust Allergy'),
63
+ gr.inputs.Textbox(placeholder='OccuPational_Hazards', default="4",numeric=True,label='OccuPational Hazards'),
64
+ gr.inputs.Textbox(placeholder='Genetic_Risk', default="3",numeric=True,label='Genetic Risk'),
65
+ gr.inputs.Textbox(placeholder='chronic_Lung_Disease', default="2",numeric=True,label='chronic Lung Disease'),
66
+ gr.inputs.Textbox(placeholder='Balanced_Diet', default="2",numeric=True,label='Balanced Diet'),
67
+ gr.inputs.Textbox(placeholder='Obesity', default="4", numeric=True,label='Obesity'),
68
+ gr.inputs.Textbox(placeholder='Smoking', default="3", numeric=True,label='Smoking'),
69
+ gr.inputs.Textbox(placeholder='Passive_Smoker', default="2", numeric=True,label='Passive Smoker'),
70
+ gr.inputs.Textbox(placeholder='Chest_Pain', default="2", numeric=True,label='Chest Pain'),
71
+ gr.inputs.Textbox(placeholder='Coughing_of_Blood', default="4", numeric=True,label='Coughing of Blood'),
72
+ gr.inputs.Textbox(placeholder='Fatigue', default="3",numeric=True,label='Fatigue'),
73
+ gr.inputs.Textbox(placeholder='Weight_Loss', default="4", numeric=True,label='Weight Loss'),
74
+ gr.inputs.Textbox(placeholder='Shortness_of_Breath', default="2", numeric=True,label='Shortness of Breath'),
75
+ gr.inputs.Textbox(placeholder='Wheezing', default="2",numeric=True,label='Wheezing'),
76
+ gr.inputs.Textbox(placeholder='Swallowing_Difficulty', default="3", numeric=True,label='Swallowing Difficulty'),
77
+ gr.inputs.Textbox(placeholder='Clubbing_of_Finger_Nails', default="1", numeric=True,label='Clubbing of Finger Nails'),
78
+ gr.inputs.Textbox(placeholder='Frequent_Cold', default="2", numeric=True,label='Frequent Cold'),
79
+ gr.inputs.Textbox(placeholder='Dry_Cough', default="3", numeric=True,label='Dry Cough'),
80
+ gr.inputs.Textbox(placeholder='Snoring', default="4", numeric=True,label='Snoring'),
81
+
82
+ ],
83
+ outputs = "text",
84
+ )
85
+
86
+ if __name__ == "__main__":
87
+ ui.launch(share=False)
Lung_cancer_prediction.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a757bc1114cfbb7e9721b89dc0a792e32eb62e07e794935d5691149c186046a0
3
+ size 3313
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ pandas
2
+ numpy
3
+ gradio
4
+ joblib