Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Load the pickled model
|
5 |
+
with open('./RF with pipe.pickle', 'rb') as file:
|
6 |
+
model = pickle.load(file)
|
7 |
+
|
8 |
+
# Define the function for making predictions
|
9 |
+
def cerviccancer(Age, Num_sexual_partners, First_sexual_intercourse, Num_pregnancies, Smokes, Smokes_years, Smokes_packs_year,
|
10 |
+
Hormonal_Contraceptives, Hormonal_Contraceptives_years, IUD, IUD_years, STDs, STDs_condylomatosis, STDs_cervical_condylomatosis,
|
11 |
+
STDs_vaginal_condylomatosis, STDs_vulvoperineal_condylomatosis, STDs_syphilis, STDs_pelvic_inflammatory_disease, STDs_genital_herpes,
|
12 |
+
STDs_molluscum_contagiosum, STDs_AIDS, STDs_HIV, STDs_Hepatitis_B, STDs_HPV, STDs_Num_of_diagnosis, Dx_Cancer, Dx_CIN, Dx, Hinselmann, Schiller, Citology):
|
13 |
+
inputs = [[Age, Num_sexual_partners, First_sexual_intercourse, Num_pregnancies, Smokes, Smokes_years, Smokes_packs_year,
|
14 |
+
Hormonal_Contraceptives, Hormonal_Contraceptives_years, IUD, IUD_years, STDs, STDs_condylomatosis, STDs_cervical_condylomatosis,
|
15 |
+
STDs_vaginal_condylomatosis, STDs_vulvoperineal_condylomatosis, STDs_syphilis, STDs_pelvic_inflammatory_disease, STDs_genital_herpes,
|
16 |
+
STDs_molluscum_contagiosum, STDs_AIDS, STDs_HIV, STDs_Hepatitis_B, STDs_HPV, STDs_Num_of_diagnosis, Dx_Cancer, Dx_CIN, Dx, Hinselmann, Schiller, Citology]]
|
17 |
+
prediction = model.predict(inputs)
|
18 |
+
prediction_value = prediction[0]
|
19 |
+
return f"Predicted probability of Biopsy: {prediction_value}"
|
20 |
+
|
21 |
+
|
22 |
+
# Create the Gradio interface
|
23 |
+
automatidata_ga = gr.Interface(fn=automatidata,
|
24 |
+
inputs = [
|
25 |
+
gr.Number(13.0, 84.0, label="Age"),
|
26 |
+
gr.Number(1.0, 28.0, label="Number of sexual partners"),
|
27 |
+
gr.Number(10.0, 32.0, label="First sexual intercourse"),
|
28 |
+
gr.Number(0.0, 11.0, label="Num of pregnancies"),
|
29 |
+
gr.Number(0.0, 1.0, label="Smokes"),
|
30 |
+
gr.Number(0.0, 37.0, label="Smokes (years)"),
|
31 |
+
gr.Number(0.0, 37.0, label="Smokes (packs/year)"),
|
32 |
+
gr.Number(0.0, 1.0, label="Hormonal Contraceptives"),
|
33 |
+
gr.Number(0.0, 30.0, label="Hormonal Contraceptives (years)"),
|
34 |
+
gr.Number(0.0, 1.0, label="IUD"),
|
35 |
+
gr.Number(0.0, 19.0, label="IUD (years)"),
|
36 |
+
gr.Number(0.0, 1.0, label="STDs"),
|
37 |
+
gr.Number(0.0, 1.0, label="STDs:condylomatosis"),
|
38 |
+
gr.Number(0.0, 0.0, label="STDs:cervical condylomatosis"),
|
39 |
+
gr.Number(0.0, 1.0, label="STDs:vaginal condylomatosis"),
|
40 |
+
gr.Number(0.0, 1.0, label="STDs:vulvo-perineal condylomatosis"),
|
41 |
+
gr.Number(0.0, 1.0, label="STDs:syphilis"),
|
42 |
+
gr.Number(0.0, 1.0, label="STDs:pelvic inflammatory disease"),
|
43 |
+
gr.Number(0.0, 1.0, label="STDs:genital herpes"),
|
44 |
+
gr.Number(0.0, 1.0, label="STDs:molluscum contagiosum"),
|
45 |
+
gr.Number(0.0, 0.0, label="STDs:AIDS"),
|
46 |
+
gr.Number(0.0, 1.0, label="STDs:HIV"),
|
47 |
+
gr.Number(0.0, 1.0, label="STDs:Hepatitis B"),
|
48 |
+
gr.Number(0.0, 1.0, label="STDs:HPV"),
|
49 |
+
gr.Number(0.0, 3.0, label="STDs: Number of diagnosis"),
|
50 |
+
gr.Number(0.0, 1.0, label="Dx:Cancer"),
|
51 |
+
gr.Number(0.0, 1.0, label="Dx:CIN"),
|
52 |
+
gr.Number(0.0, 1.0, label="Dx"),
|
53 |
+
gr.Number(0.0, 1.0, label="Hinselmann"),
|
54 |
+
gr.Number(0.0, 1.0, label="Schiller"),
|
55 |
+
gr.Number(0.0, 1.0, label="Citology"),
|
56 |
+
gr.Number(0.0, 1.0, label="Biopsy")
|
57 |
+
]
|
58 |
+
|
59 |
+
outputs="text", title="Cervical Cancer Risk Prediction",
|
60 |
+
description="Predicting probability of Biopsy Using Machine Learning.",
|
61 |
+
theme='dark'
|
62 |
+
)
|
63 |
+
|
64 |
+
automatidata_ga.launch(auth = ('parthebhan','cerviccancer'),share=True)
|