[mob] empty constructor for Face

This commit is contained in:
laurenspriem 2024-03-19 18:24:46 +05:30
parent 4d4bdb99df
commit 83d8d7ae7a
3 changed files with 15 additions and 7 deletions

View file

@ -20,6 +20,17 @@ class Face {
this.blur,
);
factory Face.empty(int fileID, {bool error = false}) {
return Face(
"$fileID-0",
fileID,
<double>[],
error ? -1.0 : 0.0,
Detection.empty(),
0.0,
);
}
factory Face.fromJson(Map<String, dynamic> json) {
return Face(
json['faceID'] as String,

View file

@ -461,13 +461,9 @@ class FaceMlService {
if (fileMl.faceEmbedding.version != faceMlVersion) continue;
if (fileMl.faceEmbedding.faces.isEmpty) {
faces.add(
Face(
'${fileMl.fileID}-0',
Face.empty(
fileMl.fileID,
<double>[],
(fileMl.faceEmbedding.error ?? false) ? -1.0 : 0.0,
face_detection.Detection.empty(),
0.0,
error: (fileMl.faceEmbedding.error ?? false),
),
);
} else {

View file

@ -123,7 +123,8 @@ class RemoteFileMLService {
}
Future<Map<int, FileMl>> decryptFileMLComputer(
Map<String, dynamic> args) async {
Map<String, dynamic> args,
) async {
final result = <int, FileMl>{};
final inputs = args["inputs"] as List<EmbeddingsDecoderInput>;
for (final input in inputs) {