forked from Hardik-Parmar/project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprediction_cxr.html
98 lines (90 loc) · 3.22 KB
/
prediction_cxr.html
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cxr 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>VGG16</td>
<td><span id="vgg_normal"></span></td>
<td><span id="vgg_covid"></span></td>
</tr>
<tr>
<td>2</td>
<td>Resnet50</td>
<td><span id="resnet_normal"></span></td>
<td><span id="resnet_covid"></span></td>
</tr>
<tr>
<td>3</td>
<td>Xception</td>
<td><span id="xception_normal"></span></td>
<td><span id="xception_covid"></span></td>
</tr>
<tr>
<td>4</td>
<td>InceptionV3</td>
<td><span id="inception_normal"></span></td>
<td><span id="inception_covid"></span></td>
</tr>
</table>
<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]);
$("#vgg_normal").text("");
$("#vgg_covid").text("");
$("#resnet_normal").text("");
$("#resnet_covid").text("");
$("#xception_normal").text("");
$("#xception_covid").text("");
$("#inception_normal").text("");
$("#inception_covid").text("");
});
$("#predict_button").click(function(event){
let message={
image:base64Image
}
console.log(message);
$.post("http://127.0.0.1:5000/predict_cxr",JSON.stringify(message),function(response){
console.log(response);
$("#vgg_normal").text(response.prediction.vgg_normal);
$("#vgg_covid").text(response.prediction.vgg_covid);
$("#resnet_normal").text(response.prediction.resnet_normal);
$("#resnet_covid").text(response.prediction.resnet_covid);
$("#xception_normal").text(response.prediction.xception_normal);
$("#xception_covid").text(response.prediction.xception_covid);
$("#inception_normal").text(response.prediction.inception_normal);
$("#inception_covid").text(response.prediction.inception_covid);
// console.log(response);
});
});
</script>
</body>
</html>