ameenmarashi commited on
Commit
26ae658
·
verified ·
1 Parent(s): 1b7b481

Upload 8 files

Browse files
classes.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"amina mostafa2024020001": 0, "misaa babnjki2024020002": 1}
group1-shard1of4.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebbdab1e709749b997c7eaf21301f50427a8e75f8a3eeafffb35f596a581a15a
3
+ size 4194304
group1-shard2of4.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b33fb298e8b05906c4add9c2579a37a141eb8fe9477b2644d000019707d5e4e
3
+ size 4194304
group1-shard3of4.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f64967234f3678d87ee2df83ee84db0b4c41b83748b506bd45c1674c4ca7be1
3
+ size 4194304
group1-shard4of4.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5081ee48bbd735bb0f963864fad07db7d5cb543b5e8d1f0d00574a2a94fa046
3
+ size 4020860
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 = [ "amina mostafa2024020001" , "misaa babnjki2024020002" , ] ;
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