Spaces:
Sleeping
Sleeping
DataWizard9742
commited on
Commit
•
e4608fe
1
Parent(s):
40bfa99
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pickle
|
4 |
+
from sklearn.preprocessing import StandardScaler
|
5 |
+
|
6 |
+
model = pickle.load(open("model-2.pkl","rb"))
|
7 |
+
|
8 |
+
def StandardScalerInput(user_input):
|
9 |
+
scaler = StandardScaler()
|
10 |
+
scaled_input = scaler.fit_transform(np.array(user_input).reshape(1,-1))
|
11 |
+
return scaled_input
|
12 |
+
|
13 |
+
st.title("CANCER DETECTION APPLICATION")
|
14 |
+
|
15 |
+
radius_mean = st.number_input('radius_mean', value=0.0)
|
16 |
+
texture_mean = st.number_input('texture_mean', value=0.0)
|
17 |
+
perimeter_mean = st.number_input('perimeter_mean', value=0.0)
|
18 |
+
area_mean = st.number_input('area_mean', value=0.0)
|
19 |
+
smoothness_mean = st.number_input('smoothness_mean', value=0.0)
|
20 |
+
compactness_mean = st.number_input('compactness_mean', value=0.0)
|
21 |
+
concavity_mean = st.number_input('concavity_mean', value=0.0)
|
22 |
+
concave_points_mean = st.number_input('concave points_mean', value=0.0)
|
23 |
+
symmetry_mean = st.number_input('symmetry_mean', value=0.0)
|
24 |
+
fractal_dimension_mean = st.number_input('fractal_dimension_mean', value=0.0)
|
25 |
+
radius_se = st.number_input('radius_se', value=0.0)
|
26 |
+
texture_se = st.number_input('texture_se', value=0.0)
|
27 |
+
perimeter_se = st.number_input('perimeter_se', value=0.0)
|
28 |
+
area_se = st.number_input('area_se', value=0.0)
|
29 |
+
smoothness_se = st.number_input('smoothness_se', value=0.0)
|
30 |
+
compactness_se = st.number_input('compactness_se', value=0.0)
|
31 |
+
concavity_se = st.number_input('concavity_se', value=0.0)
|
32 |
+
concave_points_se = st.number_input('concave points_se', value=0.0)
|
33 |
+
symmetry_se = st.number_input('symmetry_se', value=0.0)
|
34 |
+
fractal_dimension_se = st.number_input('fractal_dimension_se', value=0.0)
|
35 |
+
radius_worst = st.number_input('radius_worst', value=0.0)
|
36 |
+
texture_worst = st.number_input('texture_worst', value=0.0)
|
37 |
+
perimeter_worst = st.number_input('perimeter_worst', value=0.0)
|
38 |
+
area_worst = st.number_input('area_worst', value=0.0)
|
39 |
+
smoothness_worst = st.number_input('smoothness_worst', value=0.0)
|
40 |
+
compactness_worst = st.number_input('compactness_worst', value=0.0)
|
41 |
+
concavity_worst = st.number_input('concavity_worst', value=0.0)
|
42 |
+
concave_points_worst = st.number_input('concave points_worst', value=0.0)
|
43 |
+
symmetry_worst = st.number_input('symmetry_worst', value=0.0)
|
44 |
+
fractal_dimension_worst = st.number_input('fractal_dimension_worst', value=0.0)
|
45 |
+
|
46 |
+
user_input = [
|
47 |
+
radius_mean, texture_mean, perimeter_mean, area_mean, smoothness_mean,
|
48 |
+
compactness_mean, concavity_mean, concave_points_mean, symmetry_mean,
|
49 |
+
fractal_dimension_mean, radius_se, texture_se, perimeter_se, area_se,
|
50 |
+
smoothness_se, compactness_se, concavity_se, concave_points_se, symmetry_se,
|
51 |
+
fractal_dimension_se, radius_worst, texture_worst, perimeter_worst, area_worst,
|
52 |
+
smoothness_worst, compactness_worst, concavity_worst, concave_points_worst,
|
53 |
+
symmetry_worst, fractal_dimension_worst
|
54 |
+
]
|
55 |
+
|
56 |
+
if st.button("PREDICT"):
|
57 |
+
standardized_input = StandardScalerInput(user_input)
|
58 |
+
prediction = model.predict(standardized_input)
|
59 |
+
|
60 |
+
st.write("PREDICTION: ", 'CANCER DETECED' if prediction[0]=='M' else 'No Cancer Detected')
|