Skip to content

Commit

Permalink
fixed lag at first predict
Browse files Browse the repository at this point in the history
  • Loading branch information
w00000dy committed Mar 5, 2021
1 parent ff250f9 commit e555c9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ <h2 id="loadingText">Loading...</h2>
</tr>
</table>

<!-- is needed to prevent lag at first predict -->
<img src="tmp.png" id="img" style="display: none;">

<script>
var modelIsLoaded = false;

Expand All @@ -49,8 +52,14 @@ <h2 id="loadingText">Loading...</h2>

// When the model is loaded
function modelLoaded() {
console.log("Model Loaded!");
modelIsLoaded = true;
let img = document.getElementById("img");

handpose.predict(img, results => {
console.log(results)
console.log("Model Loaded!");
modelIsLoaded = true;
});

}
</script>
<script src="video.js"></script>
Expand Down
Binary file added tmp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e555c9f

Please sign in to comment.