This commit is contained in:
Neeraj Gupta
2024-08-09 15:54:16 +05:30
parent 1cf9a15f48
commit c8a8cbee60
3 changed files with 82 additions and 60 deletions

View File

@@ -450,28 +450,34 @@ class MLService {
}
_logger.info("inserting ${faces.length} faces for ${result.fileId}");
if (!result.errorOccured) {
await FileDataService.instance.putDerivedMetaData(
final FileDataEntity dataEntity = instruction.existingRemoteFileML ??
FileDataEntity.empty(
instruction.file.uploadedFileID!,
DataType.derivedMeta,
);
if (result.facesRan) {
dataEntity.putFace(
RemoteFaceEmbedding(
faces,
result.mlVersion,
client: client,
height: result.decodedImageSize.height,
width: result.decodedImageSize.width,
),
);
}
if (result.clipRan) {
dataEntity.putClip(
RemoteClipEmbedding(
result.clip!.embedding,
version: result.mlVersion,
client: client,
),
);
}
await FileDataService.instance.putFileData(
instruction.file,
instruction.existingRemoteFileML ??
FileDataEntity.empty(
instruction.file.uploadedFileID!,
),
faceEmbedding: result.facesRan
? RemoteFaceEmbedding(
faces,
result.mlVersion,
client: client,
height: result.decodedImageSize.height,
width: result.decodedImageSize.width,
)
: null,
clipEmbedding: result.clipRan
? RemoteClipEmbedding(
result.clip!.embedding,
version: result.mlVersion,
client: client,
)
: null,
dataEntity,
);
} else {
_logger.warning(