vladmandic / face-api

FaceAPI: AI-powered Face Detection & Rotation Tracking, Face Description & Recognition, Age & Gender & Emotion Prediction for Browser and NodeJS using TensorFlow/JS
https://vladmandic.github.io/face-api/demo/webcam.html
MIT License
824 stars 149 forks source link

Trying to load tfjs-node externally to be able to deploy on vercel. #174

Closed da7a90-backup closed 1 year ago

da7a90-backup commented 1 year ago

Issue Description I want to use https://github.com/jlarmstrongiv/tfjs-node-lambda with face-api to be able to deploy on Vercel but it still tries to get tfjs-node from node_modules making it too big to deploy. Even when I manually remove tfjs-node and add it as a dev dependency it still throws the error.

Steps to Reproduce Try to use face-api in a serverless vercel function using this package to load tfjs-node.

da7a90-backup commented 1 year ago

Also if it's not possible to use directly would it be possible to fork the library and set tf where you set tfjs-node? in the minified face-api.node.js in dist I see the require is hard coded I thought it would be there where I have to put the one compatible with lambda but wasn't too sure.

vladmandic commented 1 year ago

you can try modifying src/tfjs/tf-node.ts as that is entry point for dependencies. and then run npm run build to rebuild face-api.

but in general, not much i can do here as i don't use vercel with nodejs. this is better continued in discussions, not as an issue.