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

Error while using faceapi in angular #182

Closed TedduNithin closed 9 months ago

TedduNithin commented 9 months ago

Issue Description Getting the below error in browser console when trying to call faceapi.detectSingleFace function

face-capture.component.ts:86 ERROR Error: Uncaught (in promise): TypeError: t is not a function TypeError: t is not a function at tf-core.esm.js:17:43059 at tf-core.esm.js:17:41148 at t.scopedRun (tf-core.esm.js:17:41287) at t.tidy (tf-core.esm.js:17:41045) at f (tf-core.esm.js:17:43035) at tf-core.esm.js:17:43368 at t.scopedRun (tf-core.esm.js:17:41287) at t.runKernelFunc (tf-core.esm.js:17:43180) at t.runKernel (tf-core.esm.js:17:41724) at XM (face-api.esm.js:14:49732) at resolvePromise (zone.js:1214:31) at zone.js:1121:17 at zone.js:1137:33 at asyncGeneratorStep (asyncToGenerator.js:6:1) at _throw (asyncToGenerator.js:25:1) at _ZoneDelegate.invoke (zone.js:375:26) at Object.onInvoke (core.mjs:24210:33) at _ZoneDelegate.invoke (zone.js:374:52) at Zone.run (zone.js:134:43) at zone.js:1278:36

Steps to Reproduce

Expected Behavior

**Environment Angular version: 15.0.0 "@vladmandic/face-api": "^1.7.12",

Additional

Package.json { "name": "manappuram-kyc-app", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test" }, "private": true, "dependencies": { "@angular/animations": "^15.0.0", "@angular/cdk": "^15.2.9", "@angular/common": "^15.0.0", "@angular/compiler": "^15.0.0", "@angular/core": "^15.0.0", "@angular/forms": "^15.0.0", "@angular/material": "^15.2.9", "@angular/platform-browser": "^15.0.0", "@angular/platform-browser-dynamic": "^15.0.0", "@angular/router": "^15.0.0", "@ng-bootstrap/ng-bootstrap": "^14.0.1", "@tensorflow/tfjs": "^4.7.0", "@typescript-eslint/eslint-plugin": "^5.40.1", "@typescript-eslint/parser": "^5.40.1", "@vladmandic/face-api": "^1.7.12", "blob-util": "^2.0.2", "bootstrap": "^5.3.0", "crypto-js": "^4.2.0", "jquery": "^3.6.3", "jwt-decode": "^4.0.0", "ngx-vishwam-lib": "^1.0.32", "rxjs": "~7.5.0", "tslib": "^2.3.0", "xml-js": "^1.6.11", "zone.js": "~0.12.0" }, "devDependencies": { "@angular-devkit/build-angular": "^15.0.0", "@angular-eslint/builder": "^13.1.0", "@angular-eslint/eslint-plugin": "^14.1.2", "@angular-eslint/eslint-plugin-template": "^13.1.0", "@angular-eslint/schematics": "^15.2.1", "@angular-eslint/template-parser": "^13.1.0", "@angular/cli": "~15.0.0", "@angular/compiler-cli": "^15.0.0", "@types/crypto-js": "^4.2.1", "@types/jasmine": "~4.3.0", "@types/jsonwebtoken": "^9.0.5", "eslint": "^7.26.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-prettier": "^3.4.0", "jasmine-core": "~4.5.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.0.0", "typescript": "~4.8.2" } }

TedduNithin commented 9 months ago

Fixed by adding the faceapi.js cdn file to index.html

Thanks you so much for the library