정지호

Add a counting function

...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
24 allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> 24 allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
25 </iframe> 25 </iframe>
26 </div> 26 </div>
27 - <div id="counter" class="circle">0</div> 27 + <div id="counter" class="circle"></div>
28 </center> 28 </center>
29 </div> 29 </div>
30 <div id="label-container" class="label-container"></div> 30 <div id="label-container" class="label-container"></div>
......
...@@ -49,6 +49,8 @@ async function loop(timestamp) { ...@@ -49,6 +49,8 @@ async function loop(timestamp) {
49 let status = "stand" ; 49 let status = "stand" ;
50 // 갯수 count 50 // 갯수 count
51 let count = 0; 51 let count = 0;
52 +var counter = document.getElementById("counter");
53 +counter.textContent = count;
52 54
53 async function predict() { 55 async function predict() {
54 // Prediction #1: run input through posenet 56 // Prediction #1: run input through posenet
...@@ -62,8 +64,8 @@ async function predict() { ...@@ -62,8 +64,8 @@ async function predict() {
62 count++; 64 count++;
63 var audio = new Audio('./sound/' + count%10 + '.wav'); 65 var audio = new Audio('./sound/' + count%10 + '.wav');
64 audio.play(); 66 audio.play();
67 + counter.textContent = count;
65 console.log(count); 68 console.log(count);
66 - document.getElementById("counter").innerText(count);
67 } 69 }
68 status = "stand" 70 status = "stand"
69 } else if (prediction[1].probability.toFixed(2) == 1.00) { // 스쿼트 자세 71 } else if (prediction[1].probability.toFixed(2) == 1.00) { // 스쿼트 자세
......