This commit is contained in:
Manav Rathi 2024-05-18 15:58:31 +05:30
parent 433d0e81fc
commit bcbd805404
No known key found for this signature in database
2 changed files with 14 additions and 13 deletions

View file

@ -70,11 +70,25 @@ export const indexFaces = async (
return newMlFile;
};
export interface MLSyncFileContext {
enteFile: EnteFile;
localFile?: globalThis.File;
oldMlFile?: MlFileData;
newMlFile?: MlFileData;
imageBitmap?: ImageBitmap;
newDetection?: boolean;
newAlignment?: boolean;
}
const fetchImageBitmapForContext = async (fileContext: MLSyncFileContext) => {
if (fileContext.imageBitmap) return fileContext.imageBitmap;
const fileType = fileContext.enteFile.metadata.fileType;
if (fileContext.localFile) {
// TODO-ML(MR): Could also be image part of live photo?
if (fileType !== FILE_TYPE.IMAGE)
throw new Error("Local file of only image type is supported");

View file

@ -81,17 +81,4 @@ export interface MLSearchConfig {
enabled: boolean;
}
export interface MLSyncFileContext {
enteFile: EnteFile;
localFile?: globalThis.File;
oldMlFile?: MlFileData;
newMlFile?: MlFileData;
imageBitmap?: ImageBitmap;
newDetection?: boolean;
newAlignment?: boolean;
}
export declare type MLIndex = "files" | "people";