Open Executer13 opened 1 year ago
hi @Executer13 , were you able to get this to run in a firebase function?
Hey @appsgenie , kindly check the following repository for the example of the Face-Recognition and other examples using firebase cloud functions.
https://github.com/Executer13/firebase-cloud-function-examples
I am trying to use Face-Api-js into the firebase cloud function. However, i keep getting the error which i can not understand. Moreover, i've tried to provide it base64 String as well but still i face some errors. Now, is there a way to make this happen or face-api-js just works for the html tags?
`/ eslint-disable /
const functions = require('firebase-functions'); const admin = require('firebase-admin'); const fs = require('fs'); const fetch = require('node-fetch'); const { createCanvas, Image } = require('canvas');
// Import required libraries from face-api.js require('@tensorflow/tfjs-node'); const faceapi = require('face-api.js');
// Initialize Firebase Admin SDK admin.initializeApp();
exports.performFacialRecognitionOnCreate = functions.firestore.document('Access/{docId}').onCreate(async (snapshot, context) => { try { // Get the URL of the image file from 'picUrl' field in newly created document const picUrl = snapshot.data().picUrl;
} catch (error) { console.error('Error during facial recognition:', error); throw error; } });`