forked from Hardik-Parmar/project
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprediction_ct.html
More file actions
67 lines (62 loc) · 2.01 KB
/
prediction_ct.html
File metadata and controls
67 lines (62 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!-- Write your comments here -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ct prediction</title>
</head>
<body>
<input type="file" id="image_selector">
<button id="predict_button">Predict</button>
<p style="font-weight: bold">Predictions</p>
<br>
<table>
<tr>
<th>sr no</th>
<th>fine tuned model</th>
<th>normal</th>
<th>covid</th>
</tr>
<tr>
<td>1</td>
<td>MobilenetV2</td>
<td><span id="non_covid"></span></td>
<td><span id="covid"></span></td>
</tr>
</table>
<!-- Write your comments here -->
<img src="" id="selected_image"/>
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
<script>
let base64Image;
$('#image_selector').change(function(){
let reader=new FileReader();
reader.onload=function(e){
let dataURL=reader.result;
$('#selected_image').attr("src",dataURL);
base64Image=dataURL.replace("data:image/png;base64","");
console.log(base64Image);
}
reader.readAsDataURL($("#image_selector")[0].files[0]);
$("#non_covid").text("");
$("#covid").text("");
});
$("#predict_button").click(function(event){
let message={
image:base64Image
}
console.log(message);
$.post("http://127.0.0.1:5000/predict_ct",JSON.stringify(message),function(response){
console.log(response);
$("#non_covid").text(response.prediction.non_covid);
$("#covid").text(response.prediction.covid);
// console.log(response);
});
});
</script>
</body>
</html>