Skip to content

Commit

Permalink
Merge pull request tensorflow#853 from khanhlvg:ios-audio-pods
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 461510474
  • Loading branch information
tflite-support-robot committed Jul 18, 2022
2 parents 79a86a1 + 2ea0c32 commit 18f14ab
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 9 deletions.
26 changes: 26 additions & 0 deletions tensorflow_lite_support/ios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ strip_api_include_path_prefix(
"//tensorflow_lite_support/ios/task/processor:sources/TFLDetectionResult.h",
"//tensorflow_lite_support/ios/task/processor:sources/TFLSegmentationResult.h",
"//tensorflow_lite_support/odml/ios/image:apis/GMLImage.h",
"//tensorflow_lite_support/ios/task/audio/core:sources/TFLAudioFormat.h",
"//tensorflow_lite_support/ios/task/audio/core:sources/TFLFloatBuffer.h",
"//tensorflow_lite_support/ios/task/audio/core/audio_record:sources/TFLAudioRecord.h",
"//tensorflow_lite_support/ios/task/audio/core/audio_tensor:sources/TFLAudioTensor.h",
"//tensorflow_lite_support/ios/task/audio:sources/TFLAudioClassifier.h",
],
)

Expand Down Expand Up @@ -180,3 +185,24 @@ ios_static_framework(
"//tensorflow_lite_support/ios/task/text/qa:TFLBertQuestionAnswerer",
],
)

ios_static_framework(
name = "TensorFlowLiteTaskAudio_framework",
hdrs = [
":TFLAudioClassifier.h",
":TFLAudioFormat.h",
":TFLAudioRecord.h",
":TFLAudioTensor.h",
":TFLBaseOptions.h",
":TFLCategory.h",
":TFLClassificationOptions.h",
":TFLClassificationResult.h",
":TFLCommon.h",
":TFLFloatBuffer.h",
],
bundle_name = "TensorFlowLiteTaskAudio",
minimum_os_version = TFL_TASK_MINIMUM_OS_VERSION,
deps = [
"//tensorflow_lite_support/ios/task/audio:TFLAudioClassifier",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Pod::Spec.new do |s|
s.name = 'TensorFlowLiteTaskAudio'
s.version = '${TFLS_BUILD_VERSION}'
s.authors = 'Google Inc.'
s.license = { :type => 'Apache',:file => "LICENSE" }
s.homepage = 'https://github.com/tensorflow/tflite-support'
s.source = { :http => '${TFLS_DOWNLOAD_URL}' }
s.summary = 'TensorFlow Lite Task Library - Audio'
s.description = 'The Audio APIs of the TFLite Task Library'

s.ios.deployment_target = '10.0'

s.module_name = 'TensorFlowLiteTaskAudio'
s.static_framework = true
s.pod_target_xcconfig = {
'VALID_ARCHS' => 'x86_64, arm64, armv7',
}
s.library = 'c++'
s.frameworks = 'AVFoundation'
s.vendored_frameworks = 'Frameworks/TensorFlowLiteTaskAudio.framework'
end
5 changes: 2 additions & 3 deletions tensorflow_lite_support/ios/ios.bzl
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""TensorFlow Lite Support Library Helper Rules for iOS"""

TFL_TASK_MINIMUM_OS_VERSION = "10.0"

# When the static framework is built with bazel, the all header files are moved
# to the "Headers" directory with no header path prefixes. This auxiliary rule
# is used for stripping the path prefix to the C/iOS API header files included by
# other C/iOS API header files.
# In case of C header files includes start with a keyword of "#include'.
# Imports in iOS header files start with a keyword of '#import'.

TFL_TASK_MINIMUM_OS_VERSION = "10.0"

def strip_api_include_path_prefix(name, hdr_labels, prefix = ""):
"""Create modified header files with the import path stripped out.
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_lite_support/ios/task/audio/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ objc_library(
hdrs = [
"sources/TFLAudioClassifier.h",
],
features = ["-layering_check"],
module_name = "TFLAudioClassifier",
deps = [
"//tensorflow_lite_support/c/task/audio:audio_classifier",
"//tensorflow_lite_support/ios:TFLCommon",
"//tensorflow_lite_support/ios:TFLCommonUtils",
"//tensorflow_lite_support/ios/task/audio/core/audio_tensor:TFLAudioTensor",
"//tensorflow_lite_support/ios/task/audio/core/audio_tensor/utils:TFLAudioTensorUtils",
Expand Down
8 changes: 6 additions & 2 deletions tensorflow_lite_support/ios/task/processor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ objc_library(
"sources/TFLClassificationResult.h",
],
module_name = "TFLClassificationResult",
deps = [":TFLCategory"],
deps = [
":TFLCategory",
],
)

objc_library(
Expand All @@ -60,7 +62,9 @@ objc_library(
"sources/TFLSegmentationResult.h",
],
module_name = "TFLSegmentationResult",
deps = ["//tensorflow_lite_support/ios:TFLCommonUtils"],
deps = [
"//tensorflow_lite_support/ios:TFLCommonUtils",
],
)

objc_library(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ objc_library(
"//tensorflow_lite_support/ios:TFLCommon",
"//tensorflow_lite_support/ios/task/audio/core/audio_record:TFLAudioRecord",
"//tensorflow_lite_support/ios/test/task/audio/core/audio_record/utils:AVAudioPCMBufferUtils",
"//third_party/apple_frameworks:AVFoundation",
"//third_party/apple_frameworks:XCTest",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ objc_library(
deps = [
"//tensorflow_lite_support/ios/task/audio/core:TFLAudioFormat",
"//tensorflow_lite_support/ios/task/audio/core:TFLFloatBuffer",
"//third_party/apple_frameworks:AVFoundation",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ case $FRAMEWORK_NAME in
;;
"TensorFlowLiteTaskText")
;;
"TensorFlowLiteTaskAudio")
;;
*)
echo "Wrong framework name. The following framework names are allowed: TensorFlowLiteTaskVision, TensorFlowLiteTaskText"
echo "Wrong framework name. The following framework names are allowed: TensorFlowLiteTaskVision, TensorFlowLiteTaskText, TensorFlowLiteTaskAudio"
exit 1
;;
esac
Expand Down

0 comments on commit 18f14ab

Please sign in to comment.