Spaces:
Sleeping
Sleeping
Upload 8 files
Browse files- CNAME +1 -0
- Procfile +1 -0
- app.py +40 -0
- model.pkl +3 -0
- requirements.txt +9 -0
- static/images/img.jpeg +0 -0
- svc_classifier.pickle +3 -0
- templates/index.html +105 -0
CNAME
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
asad-999.com
|
Procfile
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
web: gunicorn app:app
|
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import pandas as pd
|
3 |
+
from flask import Flask, request, render_template
|
4 |
+
import pickle
|
5 |
+
|
6 |
+
app = Flask(__name__)
|
7 |
+
model = pickle.load(open('svc_classifier.pickle', 'rb'))
|
8 |
+
|
9 |
+
@app.route('/')
|
10 |
+
def home():
|
11 |
+
return render_template('index.html')
|
12 |
+
|
13 |
+
@app.route('/predict',methods=['POST'])
|
14 |
+
def predict():
|
15 |
+
input_features = [float(x) for x in request.form.values()]
|
16 |
+
features_value = [np.array(input_features)]
|
17 |
+
|
18 |
+
features_name = ['mean radius', 'mean texture', 'mean perimeter', 'mean area',
|
19 |
+
'mean smoothness', 'mean compactness', 'mean concavity',
|
20 |
+
'mean concave points', 'mean symmetry', 'mean fractal dimension',
|
21 |
+
'radius error', 'texture error', 'perimeter error', 'area error',
|
22 |
+
'smoothness error', 'compactness error', 'concavity error',
|
23 |
+
'concave points error', 'symmetry error', 'fractal dimension error',
|
24 |
+
'worst radius', 'worst texture', 'worst perimeter', 'worst area',
|
25 |
+
'worst smoothness', 'worst compactness', 'worst concavity',
|
26 |
+
'worst concave points', 'worst symmetry', 'worst fractal dimension']
|
27 |
+
|
28 |
+
df = pd.DataFrame(features_value, columns=features_name)
|
29 |
+
output = model.predict(df)
|
30 |
+
|
31 |
+
if output == 0:
|
32 |
+
res_val = "** breast cancer **"
|
33 |
+
else:
|
34 |
+
res_val = "no breast cancer"
|
35 |
+
|
36 |
+
|
37 |
+
return render_template('index.html', prediction_text='Patient has {}'.format(res_val))
|
38 |
+
|
39 |
+
if __name__ == "__main__":
|
40 |
+
app.run()
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eef4ae4799bff48855bd1d73051e3f41acdd3c76ad830f10798ea33ae180ef12
|
3 |
+
size 64035
|
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Flask>=2.0.2
|
2 |
+
numpy>=1.21.2
|
3 |
+
pandas>=1.3.3
|
4 |
+
scikit-learn>=0.24.2
|
5 |
+
gunicorn
|
6 |
+
itsdangerous
|
7 |
+
Jinja2
|
8 |
+
MarkupSafe
|
9 |
+
Werkzeug
|
static/images/img.jpeg
ADDED
svc_classifier.pickle
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b0bbd5fa668224b007085d458c09867b0a258e24577b14cfc9782329999db061
|
3 |
+
size 33622
|
templates/index.html
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- This is GUI for Breast Cancer Detection Application Using Machine Learning Classifer -->
|
2 |
+
|
3 |
+
<!DOCTYPE html>
|
4 |
+
<html >
|
5 |
+
<head>
|
6 |
+
<meta charset="UTF-8">
|
7 |
+
<title>ML API</title>
|
8 |
+
|
9 |
+
<style>
|
10 |
+
/* CSS code for button */
|
11 |
+
body {
|
12 |
+
background-image: url('static/images/img.jpeg');
|
13 |
+
background-repeat: no-repeat;
|
14 |
+
background-attachment: fixed;
|
15 |
+
background-size: cover;
|
16 |
+
}
|
17 |
+
|
18 |
+
/* CSS code for button */
|
19 |
+
.button_css {
|
20 |
+
color: #494949 !important;
|
21 |
+
text-transform: uppercase;
|
22 |
+
text-decoration: none;
|
23 |
+
background: #ffffff;
|
24 |
+
padding: 20px;
|
25 |
+
border: 4px solid #494949 !important;
|
26 |
+
display: inline-block;
|
27 |
+
transition: all 0.4s ease 0s;
|
28 |
+
}
|
29 |
+
|
30 |
+
.button_css:hover {
|
31 |
+
color: #ffffff !important;
|
32 |
+
background: #f6b93b;
|
33 |
+
border-color: #f6b93b !important;
|
34 |
+
transition: all 0.4s ease 0s;
|
35 |
+
}
|
36 |
+
</style>
|
37 |
+
|
38 |
+
</head>
|
39 |
+
|
40 |
+
<body>
|
41 |
+
|
42 |
+
|
43 |
+
<div class="login">
|
44 |
+
|
45 |
+
<!-- Get input for predict the cancer -->
|
46 |
+
<center>
|
47 |
+
<form action="{{ url_for('predict')}}"method="post">
|
48 |
+
<h1>Enter the value of tumor features >>></h1>
|
49 |
+
|
50 |
+
<input type="text" name="mean_radius" placeholder="mean radius" required="required" />
|
51 |
+
<input type="text" name="mean_texture" placeholder="mean texture" required="required" />
|
52 |
+
<input type="text" name="mean_perimeter" placeholder="mean perimeter" required="required" />
|
53 |
+
<input type="text" name="mean_area" placeholder="mean area" required="required" />
|
54 |
+
<input type="text" name="mean_smoothness" placeholder="mean smoothness" required="required" />
|
55 |
+
<input type="text" name="mean_compactness" placeholder="mean compactness" required="required" />
|
56 |
+
<br>
|
57 |
+
<input type="text" name="mean_concavity" placeholder="mean concavity" required="required" />
|
58 |
+
<input type="text" name="mean_concave_points" placeholder="mean concave points" required="required" />
|
59 |
+
<input type="text" name="mean_symmetry" placeholder="mean symmetry" required="required" />
|
60 |
+
<input type="text" name="mean_fractal_dimension" placeholder="mean fractal dimension" required="required" />
|
61 |
+
<input type="text" name="radius_error" placeholder="radius error" required="required" />
|
62 |
+
<input type="text" name="texture_error" placeholder="texture error" required="required" />
|
63 |
+
<br>
|
64 |
+
<input type="text" name="perimeter_error" placeholder="perimeter error" required="required" />
|
65 |
+
<input type="text" name="area_error" placeholder="area error " required="required" />
|
66 |
+
<input type="text" name="smoothness_error" placeholder="smoothness error" required="required" />
|
67 |
+
<input type="text" name="compactness_error" placeholder="compactness error" required="required" />
|
68 |
+
<input type="text" name="concavity_error" placeholder="concavity error" required="required" />
|
69 |
+
<input type="text" name="concave_points_error" placeholder="concave points error" required="required" />
|
70 |
+
<br>
|
71 |
+
<input type="text" name="symmetry_error" placeholder="symmetry error" required="required" />
|
72 |
+
<input type="text" name="fractal_dimension_error" placeholder="fractal dimension error" required="required" />
|
73 |
+
<input type="text" name="worst_radius" placeholder="worst radius" required="required" />
|
74 |
+
<input type="text" name="worst_texture" placeholder="worst texture" required="required" />
|
75 |
+
<input type="text" name="worst_perimeter" placeholder="worst perimeter" required="required" />
|
76 |
+
<input type="text" name="worst_area" placeholder="worst area" required="required" />
|
77 |
+
<br>
|
78 |
+
<input type="text" name="worst_smoothness" placeholder="worst smoothness" required="required" />
|
79 |
+
<input type="text" name="worst_compactness" placeholder="worst compactness" required="required" />
|
80 |
+
<input type="text" name="worst_concavity" placeholder="worst concavity" required="required" />
|
81 |
+
<input type="text" name="worst_concave_points" placeholder="worst concave points" required="required" />
|
82 |
+
<input type="text" name="worst_symmetry" placeholder="'worst symmetry" required="required" />
|
83 |
+
<input type="text" name="worst_fractal_dimension" placeholder="worst fractal dimension" required="required" />
|
84 |
+
<br>
|
85 |
+
<br>
|
86 |
+
|
87 |
+
<!-- Show button -->
|
88 |
+
<div class="button_cont" align="center"><a class="button_css" href="http://bit.ly/breast-cancer-ml-project" target="_blank" rel="nofollow noopener">
|
89 |
+
<button type="submit" class="btn btn-primary btn-block btn-large"><strong>Predict Cancer</strong></button></a>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
</form>
|
93 |
+
</center>
|
94 |
+
|
95 |
+
<!-- Show predicted output using ML model -->
|
96 |
+
<div>
|
97 |
+
<center>
|
98 |
+
<h1>{{ prediction_text }}</h1>
|
99 |
+
</center>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
</div>
|
103 |
+
|
104 |
+
</body>
|
105 |
+
</html>
|