This commit is contained in:
Manav Rathi 2024-05-18 19:32:34 +05:30
parent c8623bab12
commit a161203d0b
No known key found for this signature in database

View file

@ -113,8 +113,10 @@ const indexFaces_ = async (enteFile: EnteFile, imageBitmap: ImageBitmap) => {
}));
newMlFile.faces = detectedFaces;
if (newMlFile.faces && newMlFile.faces.length > 0) {
await syncFileFaceCrops(fileContext);
if (detectedFaces.length > 0) {
await Promise.all(
detectedFaces.map((face) => saveFaceCrop(imageBitmap, face)),
);
const alignedFacesData = await syncFileFaceAlignments(fileContext);
@ -339,14 +341,6 @@ const makeFaceID = (
return [`${fileID}`, xMin, yMin, xMax, yMax].join("_");
};
const syncFileFaceCrops = async (fileContext: MLSyncFileContext) => {
const { newMlFile } = fileContext;
const imageBitmap = fileContext.imageBitmap;
for (const face of newMlFile.faces) {
await saveFaceCrop(imageBitmap, face);
}
};
const syncFileFaceAlignments = async (
fileContext: MLSyncFileContext,
): Promise<Float32Array> => {