Changed method Updated method calls to process packet map in iOS text tasks
This commit is contained in:
parent
6d7f172e9f
commit
045050fc85
|
@ -83,15 +83,16 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_classifier.T
|
||||||
Packet packet = [MPPTextPacketCreator createWithText:text];
|
Packet packet = [MPPTextPacketCreator createWithText:text];
|
||||||
|
|
||||||
std::map<std::string, Packet> packetMap = {{kTextInStreamName.cppString, packet}};
|
std::map<std::string, Packet> packetMap = {{kTextInStreamName.cppString, packet}};
|
||||||
absl::StatusOr<PacketMap> statusOrOutputPacketMap = [_textTaskRunner process:packetMap];
|
std::optional<PacketMap> outputPacketMap = [_textTaskRunner processPacketMap:packetMap
|
||||||
|
error:error];
|
||||||
|
|
||||||
if (![MPPCommonUtils checkCppError:statusOrOutputPacketMap.status() toError:error]) {
|
if (!outputPacketMap.has_value()) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [MPPTextClassifierResult
|
return
|
||||||
textClassifierResultWithClassificationsPacket:statusOrOutputPacketMap.value()
|
[MPPTextClassifierResult textClassifierResultWithClassificationsPacket:
|
||||||
[kClassificationsStreamName.cppString]];
|
outputPacketMap.value()[kClassificationsStreamName.cppString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -83,14 +83,15 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_embedder.Tex
|
||||||
Packet packet = [MPPTextPacketCreator createWithText:text];
|
Packet packet = [MPPTextPacketCreator createWithText:text];
|
||||||
|
|
||||||
std::map<std::string, Packet> packetMap = {{kTextInStreamName.cppString, packet}};
|
std::map<std::string, Packet> packetMap = {{kTextInStreamName.cppString, packet}};
|
||||||
absl::StatusOr<PacketMap> statusOrOutputPacketMap = [_textTaskRunner process:packetMap];
|
|
||||||
|
|
||||||
if (![MPPCommonUtils checkCppError:statusOrOutputPacketMap.status() toError:error]) {
|
std::optional<PacketMap> outputPacketMap = [_textTaskRunner processPacketMap:packetMap
|
||||||
|
error:error];
|
||||||
|
|
||||||
|
if (!outputPacketMap.has_value()) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [MPPTextEmbedderResult
|
return [MPPTextEmbedderResult
|
||||||
textEmbedderResultWithOutputPacket:statusOrOutputPacketMap
|
textEmbedderResultWithOutputPacket:outputPacketMap
|
||||||
.value()[kEmbeddingsOutStreamName.cppString]];
|
.value()[kEmbeddingsOutStreamName.cppString]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user