Live demo: [https://age.devel.private.id/]
also added some code below which is not working out for me and giving me -1 as a age
import { loadPrivIdModule, isValid, predictAge } from '@privateid/cryptonets-web-sdk';
export const initializeSDK = async () => {
const isSupported = await loadPrivIdModule({
api_url: {
collections: {
default:{
named_urls: {
base_url: "https://api.prodv3.cryptonets.ai",
enroll: "https://api.prodv3.cryptonets.ai/node/FACE4_2/enroll",
predict: "https://api.prodv3.cryptonets.ai/node/FACE4_2/predict",
// deleteUser: "https://api.prodv3.cryptonets.ai/node/FACE4_2/deleteUser",
// syncUUID: "https://api.prodv3.cryptonets.ai/node/FACE4_2/syncUUID"
}
}
}
},
api_key: "",
});
return isSupported;
};
// ***********************
// {
// support: boolean,
// message: string,
// }
// ****************
export const checkFaceValidity = async (callback) => {
await isValid(callback);
};
export const getAgePrediction = async (webcamRef) => {
console.log("🚀 ~ file: sdkUtil.js:40 ~ getAgePrediction ~ webcamRef:", webcamRef)
const capturedFrame = await webcamRef.current.getScreenshot(); // Or use corresponding method
console.log("🚀 ~ file: sdkUtil.js:42 ~ getAgePrediction ~ capturedFrame:", capturedFrame)
// const canvas = document.createElement('canvas');
// const context = canvas.getContext('2d');
// canvas.width = video.videoWidth;
// canvas.height = video.videoHeight;
// context.drawImage(video, 0, 0);
// const frameData = canvas.toDataURL('image/jpeg');
const result = predictAge(capturedFrame)
.then(predictAge => console.log(predictAge, " predictAge "))
.catch(error => console.log(error, " PREDICT AGE ERROR "));
console.log("🚀 ~ file: sdkUtil.js:45 ~ getAgePrediction ~ result:", result)
};
Live demo: [https://age.devel.private.id/]
also added some code below which is not working out for me and giving me -1 as a age
import { loadPrivIdModule, isValid, predictAge } from '@privateid/cryptonets-web-sdk';
export const initializeSDK = async () => {
const isSupported = await loadPrivIdModule({
api_url: {
collections: {
default:{
named_urls: {
base_url: "https://api.prodv3.cryptonets.ai",
enroll: "https://api.prodv3.cryptonets.ai/node/FACE4_2/enroll",
predict: "https://api.prodv3.cryptonets.ai/node/FACE4_2/predict",
// deleteUser: "https://api.prodv3.cryptonets.ai/node/FACE4_2/deleteUser",
// syncUUID: "https://api.prodv3.cryptonets.ai/node/FACE4_2/syncUUID"
}
}
}
},
api_key: "",
});
return isSupported;
};
// ***********************
// {
// support: boolean,
// message: string,
// }
// ****************
export const checkFaceValidity = async (callback) => {
await isValid(callback);
};
export const getAgePrediction = async (webcamRef) => {
console.log("🚀 ~ file: sdkUtil.js:40 ~ getAgePrediction ~ webcamRef:", webcamRef)
const capturedFrame = await webcamRef.current.getScreenshot(); // Or use corresponding method
console.log("🚀 ~ file: sdkUtil.js:42 ~ getAgePrediction ~ capturedFrame:", capturedFrame)
// const canvas = document.createElement('canvas');
// const context = canvas.getContext('2d');
// canvas.width = video.videoWidth;
// canvas.height = video.videoHeight;
// context.drawImage(video, 0, 0);
// const frameData = canvas.toDataURL('image/jpeg');
const result = predictAge(capturedFrame)
.then(predictAge => console.log(predictAge, " predictAge "))
.catch(error => console.log(error, " PREDICT AGE ERROR "));
console.log("🚀 ~ file: sdkUtil.js:45 ~ getAgePrediction ~ result:", result)
};