Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I import with vite? #929

Open
pickaxe828 opened this issue Dec 23, 2023 · 0 comments
Open

How do I import with vite? #929

pickaxe828 opened this issue Dec 23, 2023 · 0 comments

Comments

@pickaxe828
Copy link

main js code

import CameraPhoto, { FACING_MODES, IMAGE_TYPES } from 'jslib-html5-camera-photo'
import * as faceapi from 'face-api.js'
import weight from "../weights/face_landmark_68_model-shard1?url"

let videoElement = document.getElementById('videoId')
let imgElement = document.getElementById('imgId')
let toggleVideoBtn = document.getElementById('toggleVideo')
let takePictureBtn = document.getElementById('takePicture')

console.log(weight)
await faceapi.nets.faceLandmark68Net.loadFromUri(weight)

// ...

takePictureBtn.addEventListener('click', async () => {
    const config = {}
    let dataUri = cameraPhoto.getDataUri(config)
    imgElement.src = dataUri
    const result = await faceapi.detectSingleFace(imgElement).withFaceLandmarks().withFaceDescriptor()
    console.log(result.descriptor)
})

then I got this error
image
how do I fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant