|
a |
|
b/templates/Home.html |
|
|
1 |
<html lang="en"> |
|
|
2 |
|
|
|
3 |
<head> |
|
|
4 |
<meta charset="UTF-8"> |
|
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
6 |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> |
|
|
7 |
<title>AI Demo</title> |
|
|
8 |
<link href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"> |
|
|
9 |
<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js"></script> |
|
|
10 |
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> |
|
|
11 |
<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> |
|
|
12 |
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet"> |
|
|
13 |
<link rel="stylesheet" href="C:\Users\junnajamshed\Desktop\projectCopy\static\css\navstyle.css"> |
|
|
14 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> |
|
|
15 |
<style> |
|
|
16 |
body{ |
|
|
17 |
width: 100%; |
|
|
18 |
height: 100vh; |
|
|
19 |
display: block; |
|
|
20 |
background-size: 300% 300%; |
|
|
21 |
background-image: linear-gradient( |
|
|
22 |
-45deg, |
|
|
23 |
rgba(59,173,227,1) 0%, |
|
|
24 |
rgba(87,111,230,1) 25%, |
|
|
25 |
rgba(152,68,183,1) 51%, |
|
|
26 |
rgba(255,53,127,1) 100% |
|
|
27 |
); |
|
|
28 |
animation: AnimateBG 20s ease infinite; |
|
|
29 |
} |
|
|
30 |
|
|
|
31 |
@keyframes AnimateBG { |
|
|
32 |
0%{background-position:0% 50%} |
|
|
33 |
50%{background-position:100% 50%} |
|
|
34 |
100%{background-position:0% 50%} |
|
|
35 |
} |
|
|
36 |
* { |
|
|
37 |
padding: 0; |
|
|
38 |
margin: 0; |
|
|
39 |
text-decoration: none; |
|
|
40 |
list-style: none; |
|
|
41 |
box-sizing: border-box; |
|
|
42 |
} |
|
|
43 |
body { |
|
|
44 |
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; |
|
|
45 |
} |
|
|
46 |
|
|
|
47 |
nav { |
|
|
48 |
background: #022f69; |
|
|
49 |
height: 80px; |
|
|
50 |
width: 100%; |
|
|
51 |
} |
|
|
52 |
label.logo { |
|
|
53 |
color: #fff; |
|
|
54 |
font-size: 35px; |
|
|
55 |
line-height: 80px; |
|
|
56 |
padding: 0 100px; |
|
|
57 |
font-weight: bold; |
|
|
58 |
} |
|
|
59 |
nav ul { |
|
|
60 |
float: right; |
|
|
61 |
margin-right: 20px; |
|
|
62 |
} |
|
|
63 |
nav ul li { |
|
|
64 |
display: inline-block; |
|
|
65 |
line-height: 80px; |
|
|
66 |
margin: 0 5px; |
|
|
67 |
} |
|
|
68 |
nav ul li a { |
|
|
69 |
color: #fff; |
|
|
70 |
font-size: 17px; |
|
|
71 |
padding: 7px 13px; |
|
|
72 |
border-radius: 3px; |
|
|
73 |
text-transform: uppercase; |
|
|
74 |
} |
|
|
75 |
a.active, |
|
|
76 |
a:hover { |
|
|
77 |
background: #fff; |
|
|
78 |
transition: 0.5s; |
|
|
79 |
color: #022f69; |
|
|
80 |
} |
|
|
81 |
.checkbtn { |
|
|
82 |
font-size: 30px; |
|
|
83 |
color: #fff; |
|
|
84 |
float: right; |
|
|
85 |
line-height: 80px; |
|
|
86 |
margin-right: 40px; |
|
|
87 |
cursor: pointer; |
|
|
88 |
display: none; |
|
|
89 |
} |
|
|
90 |
#check { |
|
|
91 |
display: none; |
|
|
92 |
} |
|
|
93 |
@media (max-width: 968px) { |
|
|
94 |
label.logo { |
|
|
95 |
font-size: 30px; |
|
|
96 |
padding-left: 50px; |
|
|
97 |
} |
|
|
98 |
nav ul li a { |
|
|
99 |
font-size: 16px; |
|
|
100 |
} |
|
|
101 |
} |
|
|
102 |
@media (max-width: 875px) { |
|
|
103 |
.checkbtn { |
|
|
104 |
display: block; |
|
|
105 |
} |
|
|
106 |
nav ul { |
|
|
107 |
position: fixed; |
|
|
108 |
width: 100%; |
|
|
109 |
height: 100vh; |
|
|
110 |
background: #27282c; |
|
|
111 |
top: 80px; |
|
|
112 |
left: -100%; |
|
|
113 |
text-align: center; |
|
|
114 |
transition: all 0.5s; |
|
|
115 |
} |
|
|
116 |
nav ul li { |
|
|
117 |
display: block; |
|
|
118 |
margin: 50px 0; |
|
|
119 |
line-height: 30px; |
|
|
120 |
} |
|
|
121 |
nav ul li a { |
|
|
122 |
font-size: 20px; |
|
|
123 |
} |
|
|
124 |
a:hover, |
|
|
125 |
a.active { |
|
|
126 |
background: none; |
|
|
127 |
color: #0082e6; |
|
|
128 |
} |
|
|
129 |
#check:checked ~ ul { |
|
|
130 |
left: 0; |
|
|
131 |
} |
|
|
132 |
} |
|
|
133 |
.img-preview { |
|
|
134 |
width: 256px; |
|
|
135 |
height: 256px; |
|
|
136 |
position: relative; |
|
|
137 |
border: 5px solid #f8f8f8; |
|
|
138 |
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1); |
|
|
139 |
margin-top: 1em; |
|
|
140 |
margin-bottom: 1em; |
|
|
141 |
} |
|
|
142 |
|
|
|
143 |
.img-preview > div { |
|
|
144 |
width: 100%; |
|
|
145 |
height: 100%; |
|
|
146 |
background-size: 256px 256px; |
|
|
147 |
background-repeat: no-repeat; |
|
|
148 |
background-position: center; |
|
|
149 |
} |
|
|
150 |
|
|
|
151 |
input[type="file"] { |
|
|
152 |
display: none; |
|
|
153 |
} |
|
|
154 |
|
|
|
155 |
.upload-label { |
|
|
156 |
display: inline-block; |
|
|
157 |
padding: 12px 30px; |
|
|
158 |
background: #39d2b4; |
|
|
159 |
color: #fff; |
|
|
160 |
font-size: 1em; |
|
|
161 |
transition: all 0.4s; |
|
|
162 |
cursor: pointer; |
|
|
163 |
} |
|
|
164 |
|
|
|
165 |
.upload-label:hover { |
|
|
166 |
background: #34495e; |
|
|
167 |
color: #39d2b4; |
|
|
168 |
} |
|
|
169 |
|
|
|
170 |
.loader { |
|
|
171 |
border: 8px solid #f3f3f3; /* Light grey */ |
|
|
172 |
border-top: 8px solid #3498db; /* Blue */ |
|
|
173 |
border-radius: 50%; |
|
|
174 |
width: 50px; |
|
|
175 |
height: 50px; |
|
|
176 |
animation: spin 1s linear infinite; |
|
|
177 |
} |
|
|
178 |
|
|
|
179 |
@keyframes spin { |
|
|
180 |
0% { |
|
|
181 |
transform: rotate(0deg); |
|
|
182 |
} |
|
|
183 |
100% { |
|
|
184 |
transform: rotate(360deg); |
|
|
185 |
} |
|
|
186 |
} |
|
|
187 |
|
|
|
188 |
</style> |
|
|
189 |
</head> |
|
|
190 |
|
|
|
191 |
<body> |
|
|
192 |
<nav> |
|
|
193 |
<input type="checkbox" id="check"> |
|
|
194 |
<label for="check" class="checkbtn"> |
|
|
195 |
<i class="fas fa-bars"></i> |
|
|
196 |
</label> |
|
|
197 |
<label class="logo">Leukemia Cancer Detection</label> |
|
|
198 |
<ul> |
|
|
199 |
<li><a href="Home.html">Home</a></li> |
|
|
200 |
<li><a class="active" href="index.html">Detection</a></li> |
|
|
201 |
|
|
|
202 |
<li><a href="about.html">About us</a></li> |
|
|
203 |
<li><a href="#">Contact</a></li> |
|
|
204 |
</ul> |
|
|
205 |
</nav> |
|
|
206 |
<div class="container"> |
|
|
207 |
<div id="content" style="margin-top:2em">{% block content %}{% endblock %}</div> |
|
|
208 |
</div> |
|
|
209 |
</body> |
|
|
210 |
|
|
|
211 |
<footer> |
|
|
212 |
<script > |
|
|
213 |
$(document).ready(function () { |
|
|
214 |
// Init |
|
|
215 |
$('.image-section').hide(); |
|
|
216 |
$('.loader').hide(); |
|
|
217 |
$('#result').hide(); |
|
|
218 |
|
|
|
219 |
// Upload Preview |
|
|
220 |
function readURL(input) { |
|
|
221 |
if (input.files && input.files[0]) { |
|
|
222 |
var reader = new FileReader(); |
|
|
223 |
reader.onload = function (e) { |
|
|
224 |
$('#imagePreview').css('background-image', 'url(' + e.target.result + ')'); |
|
|
225 |
$('#imagePreview').hide(); |
|
|
226 |
$('#imagePreview').fadeIn(650); |
|
|
227 |
} |
|
|
228 |
reader.readAsDataURL(input.files[0]); |
|
|
229 |
} |
|
|
230 |
} |
|
|
231 |
$("#imageUpload").change(function () { |
|
|
232 |
$('.image-section').show(); |
|
|
233 |
$('#btn-predict').show(); |
|
|
234 |
$('#result').text(''); |
|
|
235 |
$('#result').hide(); |
|
|
236 |
readURL(this); |
|
|
237 |
}); |
|
|
238 |
|
|
|
239 |
// Predict |
|
|
240 |
$('#btn-predict').click(function () { |
|
|
241 |
var form_data = new FormData($('#upload-file')[0]); |
|
|
242 |
|
|
|
243 |
// Show loading animation |
|
|
244 |
$(this).hide(); |
|
|
245 |
$('.loader').show(); |
|
|
246 |
|
|
|
247 |
// Make prediction by calling api /predict |
|
|
248 |
$.ajax({ |
|
|
249 |
type: 'POST', |
|
|
250 |
url: '/predict', |
|
|
251 |
data: form_data, |
|
|
252 |
contentType: false, |
|
|
253 |
cache: false, |
|
|
254 |
processData: false, |
|
|
255 |
async: true, |
|
|
256 |
success: function (data) { |
|
|
257 |
// Get and display the result |
|
|
258 |
$('.loader').hide(); |
|
|
259 |
$('#result').fadeIn(600); |
|
|
260 |
$('#result').text(' Result: ' + data); |
|
|
261 |
console.log('Success!'); |
|
|
262 |
}, |
|
|
263 |
}); |
|
|
264 |
}); |
|
|
265 |
|
|
|
266 |
}); |
|
|
267 |
|
|
|
268 |
</script> |
|
|
269 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> |
|
|
270 |
</footer> |
|
|
271 |
|
|
|
272 |
</html> |