diff --git a/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.h b/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.h index d1deb60ed..a45ab6747 100644 --- a/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.h +++ b/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.h @@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN /** * @brief Performs embedding extraction on text. * - * This API expects a TFLite model with (optional) [TFLite Model Metadata](https://www.tensorflow.org/lite/convert/metadata"). + * This API expects a TFLite model with (optional) [TFLite Model + * Metadata](https://www.tensorflow.org/lite/convert/metadata"). * * Metadata is required for models with int32 input tensors because it contains the input process * unit for the model's Tokenizer. No metadata is required for models with string input tensors. @@ -38,7 +39,8 @@ NS_ASSUME_NONNULL_BEGIN * - Or one input tensor (`kTfLiteString`) that is shapeless or has shape `[1]` containing * the input string. * - * At least one output tensor (`kTfLiteFloat32`/`kTfLiteUint8`) with shape `[1 x N]` where `N` is the number of dimensions in the produced embeddings. + * At least one output tensor (`kTfLiteFloat32`/`kTfLiteUint8`) with shape `[1 x N]` where `N` is + * the number of dimensions in the produced embeddings. */ NS_SWIFT_NAME(TextEmbedder) @interface MPPTextEmbedder : NSObject @@ -80,7 +82,7 @@ NS_SWIFT_NAME(TextEmbedder) * @return A `MPPTextEmbedderResult` object that contains a list of embeddings. */ - (nullable MPPTextEmbedderResult *)embedText:(NSString *)text - error:(NSError **)error NS_SWIFT_NAME(embed(text:)); + error:(NSError **)error NS_SWIFT_NAME(embed(text:)); - (instancetype)init NS_UNAVAILABLE; diff --git a/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.mm b/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.mm index 395ce28f6..a9c811cdb 100644 --- a/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.mm +++ b/mediapipe/tasks/ios/text/text_embedder/sources/MPPTextEmbedder.mm @@ -89,8 +89,8 @@ static NSString *const kTaskGraphName = @"mediapipe.tasks.text.text_embedder.Tex } return [MPPTextEmbedderResult - textEmbedderResultWithOutputPacket:statusOrOutputPacketMap.value() - [kEmbeddingsOutStreamName.cppString]]; + textEmbedderResultWithOutputPacket:statusOrOutputPacketMap + .value()[kEmbeddingsOutStreamName.cppString]]; } @end diff --git a/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderOptions+Helpers.mm b/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderOptions+Helpers.mm index c2450f955..e17b6e8da 100644 --- a/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderOptions+Helpers.mm +++ b/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderOptions+Helpers.mm @@ -17,8 +17,8 @@ #import "mediapipe/tasks/ios/common/utils/sources/NSString+Helpers.h" #import "mediapipe/tasks/ios/core/utils/sources/MPPBaseOptions+Helpers.h" -#include "mediapipe/tasks/cc/text/text_embedder/proto/text_embedder_graph_options.pb.h" #include "mediapipe/tasks/cc/components/processors/proto/embedder_options.pb.h" +#include "mediapipe/tasks/cc/text/text_embedder/proto/text_embedder_graph_options.pb.h" namespace { using CalculatorOptionsProto = ::mediapipe::CalculatorOptions; diff --git a/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.h b/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.h index de899a103..0a808a54b 100644 --- a/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.h +++ b/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.h @@ -20,8 +20,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MPPTextEmbedderResult (Helpers) -+ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket: - (const mediapipe::Packet &)packet; ++ (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const mediapipe::Packet &)packet; @end diff --git a/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.mm b/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.mm index bba1b345e..b769292ce 100644 --- a/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.mm +++ b/mediapipe/tasks/ios/text/text_embedder/utils/sources/MPPTextEmbedderResult+Helpers.mm @@ -20,8 +20,7 @@ static const int kMicroSecondsPerMilliSecond = 1000; namespace { -using EmbeddingResultProto = - ::mediapipe::tasks::components::containers::proto::EmbeddingResult; +using EmbeddingResultProto = ::mediapipe::tasks::components::containers::proto::EmbeddingResult; using ::mediapipe::Packet; } // namespace @@ -30,13 +29,13 @@ using ::mediapipe::Packet; @implementation MPPTextEmbedderResult (Helpers) + (MPPTextEmbedderResult *)textEmbedderResultWithOutputPacket:(const Packet &)packet { - MPPEmbeddingResult *embeddingResult = [MPPEmbeddingResult - embeddingResultWithProto:packet.Get()]; + MPPEmbeddingResult *embeddingResult = + [MPPEmbeddingResult embeddingResultWithProto:packet.Get()]; return [[MPPTextEmbedderResult alloc] initWithEmbeddingResult:embeddingResult - timestampMs:(NSInteger)(packet.Timestamp().Value() / - kMicroSecondsPerMilliSecond)]; + timestampMs:(NSInteger)(packet.Timestamp().Value() / + kMicroSecondsPerMilliSecond)]; } @end