File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 15
15
< div class ="indeterminate "> </ div >
16
16
</ div >
17
17
< div style ="position: relative " class ="margin ">
18
- < video src ="media/bbt.mp4 " onplay ="onPlay(this) " autoplay muted > </ video >
18
+ < video src ="media/bbt.mp4 " onplay ="onPlay(this) " id =" inputVideo " autoplay muted > </ video >
19
19
< canvas id ="overlay " />
20
20
</ div >
21
21
< div class ="row side-by-side ">
50
50
51
51
< script >
52
52
let minConfidence = 0.7
53
+ let modelLoaded = false
53
54
let result
54
55
55
56
function onIncreaseThreshold ( ) {
68
69
}
69
70
70
71
async function onPlay ( videoEl ) {
71
- if ( videoEl . paused || videoEl . ended )
72
+ if ( videoEl . paused || videoEl . ended || ! modelLoaded )
72
73
return false
73
74
74
75
const input = await faceapi . toNetInput ( videoEl )
87
88
88
89
async function run ( ) {
89
90
await faceapi . loadFaceDetectionModel ( '/' )
91
+ modelLoaded = true
92
+ onPlay ( $ ( '#inputVideo' ) . get ( 0 ) )
90
93
$ ( '#loader' ) . hide ( )
91
94
}
92
95
You can’t perform that action at this time.
0 commit comments