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];
|
||||
|
||||
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 [MPPTextClassifierResult
|
||||
textClassifierResultWithClassificationsPacket:statusOrOutputPacketMap.value()
|
||||
[kClassificationsStreamName.cppString]];
|
||||
return
|
||||
[MPPTextClassifierResult textClassifierResultWithClassificationsPacket:
|
||||
outputPacketMap.value()[kClassificationsStreamName.cppString]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -83,14 +83,15 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_embedder.Tex
|
|||
Packet packet = [MPPTextPacketCreator createWithText:text];
|
||||
|
||||
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 [MPPTextEmbedderResult
|
||||
textEmbedderResultWithOutputPacket:statusOrOutputPacketMap
|
||||
textEmbedderResultWithOutputPacket:outputPacketMap
|
||||
.value()[kEmbeddingsOutStreamName.cppString]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user