Spaces:
Running
Running
Upload 8 files
Browse files- classes.json +1 -0
- group1-shard1of4.bin +3 -0
- group1-shard2of4.bin +3 -0
- group1-shard3of4.bin +3 -0
- group1-shard4of4.bin +3 -0
- image.jpg +0 -0
- index.html +49 -0
- model.json +0 -0
classes.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"In-active Neovascular AMD": 0, "Intermediate non-neovascular AMD": 1, "Non-neovascular AMD with Geographic atrophy": 2, "Normal": 3, "Active Neovascular AMD": 4, "Advanced non-neovascular AMD": 5}
|
group1-shard1of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:434a9eb3ee82f2680dee294a842fb28158c6df469805d42c7d0c7c9df8be4072
|
| 3 |
+
size 4194304
|
group1-shard2of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d0416bb1b9b1873b892577b58f5fe12eeed9f9e4b19aff29a8ddcc073ac5a5d
|
| 3 |
+
size 4194304
|
group1-shard3of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0c81477a8bb345dca9cab4f22e956d3e66641a1af4296e52ec445eed7981965
|
| 3 |
+
size 4194304
|
group1-shard4of4.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4cb66cd075a0d50dbba2393a717f2366cc6b65ccf982d6131f1de2a2ca697789
|
| 3 |
+
size 3394700
|
image.jpg
ADDED
|
index.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
|
| 5 |
+
</head>
|
| 6 |
+
<body>
|
| 7 |
+
|
| 8 |
+
Make sure to run this via a server
|
| 9 |
+
|
| 10 |
+
<br>
|
| 11 |
+
<input accept="image/*" type='file' id="input_button" />
|
| 12 |
+
|
| 13 |
+
<br>
|
| 14 |
+
<img id="img1" src="./image.jpg" style="width: 300px " />
|
| 15 |
+
<br> <br>
|
| 16 |
+
<button onclick="predict()">predict</button>
|
| 17 |
+
<br>
|
| 18 |
+
<p id="result"> </p>
|
| 19 |
+
|
| 20 |
+
<script>
|
| 21 |
+
|
| 22 |
+
let image = document.getElementById('img1');
|
| 23 |
+
let input_button = document.getElementById('input_button');
|
| 24 |
+
|
| 25 |
+
input_button.onchange = evt => {
|
| 26 |
+
const [file] = input_button.files
|
| 27 |
+
if (file) {
|
| 28 |
+
image.src = URL.createObjectURL(file)
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
async function predict() {
|
| 33 |
+
var model = await tf.loadGraphModel('./model.json');
|
| 34 |
+
|
| 35 |
+
let example = tf.browser.fromPixels(document.getElementById("img1") , 3 ).cast('float32');
|
| 36 |
+
console.log( example.shape )
|
| 37 |
+
example = example.reshape([1,example.shape[0], example.shape[1] ,example.shape[2]]);
|
| 38 |
+
|
| 39 |
+
let prediction = await model.predict(example);
|
| 40 |
+
let class_scores = await prediction.data();
|
| 41 |
+
let max_score_id = class_scores.indexOf(Math.max(...class_scores));
|
| 42 |
+
let classes = [ "In-active Neovascular AMD" , "Intermediate non-neovascular AMD" , "Non-neovascular AMD with Geographic atrophy" , "Normal" , "Active Neovascular AMD" , "Advanced non-neovascular AMD" , ] ;
|
| 43 |
+
|
| 44 |
+
console.log(class_scores);
|
| 45 |
+
document.getElementById("result").innerHTML = classes[max_score_id].toString();
|
| 46 |
+
}
|
| 47 |
+
</script>
|
| 48 |
+
</body>
|
| 49 |
+
</html>
|
model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|