├── .flutter-mediapipe-root ├── .github ├── ISSUE_TEMPLATE │ ├── ---bug-report.md │ ├── ---documentation-feedback.md │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── builder.yaml │ └── main.yaml ├── .gitignore ├── .vscode └── settings.json ├── AUTHORS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── assets ├── empty-models.png ├── no.png └── yes.png ├── packages ├── analysis_options.yaml ├── mediapipe-core │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── ffigen.yaml │ ├── lib │ │ ├── generated │ │ │ └── core_symbols.yaml │ │ ├── interface.dart │ │ ├── io.dart │ │ ├── mediapipe_core.dart │ │ ├── src │ │ │ ├── extensions.dart │ │ │ ├── ffi_utils.dart │ │ │ ├── interface │ │ │ │ ├── containers.dart │ │ │ │ ├── interface.dart │ │ │ │ ├── task_options.dart │ │ │ │ └── task_result.dart │ │ │ ├── io │ │ │ │ ├── containers.dart │ │ │ │ ├── ffi_utils.dart │ │ │ │ ├── mediapipe_core.dart │ │ │ │ ├── task_executor.dart │ │ │ │ ├── task_options.dart │ │ │ │ ├── task_result.dart │ │ │ │ ├── test_utils.dart │ │ │ │ └── third_party │ │ │ │ │ └── mediapipe │ │ │ │ │ └── generated │ │ │ │ │ └── mediapipe_common_bindings.dart │ │ │ └── web │ │ │ │ └── mediapipe_core.dart │ │ └── universal_mediapipe_core.dart │ ├── pubspec.yaml │ ├── test │ │ └── io │ │ │ ├── containers_test.dart │ │ │ ├── embedding_test.dart │ │ │ ├── ffi_utils_test.dart │ │ │ └── task_options_test.dart │ └── third_party │ │ └── mediapipe │ │ └── tasks │ │ └── c │ │ ├── components │ │ ├── containers │ │ │ ├── category.h │ │ │ ├── classification_result.h │ │ │ └── embedding_result.h │ │ └── processors │ │ │ ├── classifier_options.h │ │ │ └── embedder_options.h │ │ └── core │ │ └── base_options.h ├── mediapipe-task-audio │ ├── LICENSE │ ├── README.md │ └── sdk_downloads.dart ├── mediapipe-task-genai │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── example │ │ ├── .gitignore │ │ ├── .metadata │ │ ├── .vscode │ │ │ └── launch.json │ │ ├── README.md │ │ ├── analysis_options.yaml │ │ ├── android │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ │ ├── main │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── res │ │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ ├── build.gradle │ │ │ ├── gradle.properties │ │ │ ├── gradle │ │ │ │ └── wrapper │ │ │ │ │ └── gradle-wrapper.properties │ │ │ └── settings.gradle │ │ ├── ios │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── AppFrameworkInfo.plist │ │ │ │ ├── Debug.xcconfig │ │ │ │ └── Release.xcconfig │ │ │ ├── Podfile │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ ├── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ │ └── LaunchImage.imageset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ │ └── README.md │ │ │ │ ├── Base.lproj │ │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ │ └── Main.storyboard │ │ │ │ ├── Info.plist │ │ │ │ └── Runner-Bridging-Header.h │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── lib │ │ │ ├── bloc.dart │ │ │ ├── bloc.freezed.dart │ │ │ ├── fake_inference_engine.dart │ │ │ ├── llm_inference_demo.dart │ │ │ ├── logging.dart │ │ │ ├── main.dart │ │ │ ├── model_location_provider.dart │ │ │ ├── model_selection_screen.dart │ │ │ ├── model_storage │ │ │ │ ├── io_model_storage.dart │ │ │ │ ├── model_storage.dart │ │ │ │ ├── model_storage_interface.dart │ │ │ │ └── universal_model_storage.dart │ │ │ ├── models │ │ │ │ ├── chat_message.dart │ │ │ │ ├── chat_message.freezed.dart │ │ │ │ ├── llm_model.dart │ │ │ │ ├── llm_model.freezed.dart │ │ │ │ └── models.dart │ │ │ └── widgets │ │ │ │ ├── chat_input.dart │ │ │ │ ├── chat_screen.dart │ │ │ │ ├── configuration_panel.dart │ │ │ │ ├── keyboard_hider.dart │ │ │ │ ├── typing_indicator.dart │ │ │ │ └── widgets.dart │ │ ├── macos │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── Flutter-Debug.xcconfig │ │ │ │ └── Flutter-Release.xcconfig │ │ │ ├── Podfile │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ │ └── app_icon_64.png │ │ │ │ ├── Base.lproj │ │ │ │ │ └── MainMenu.xib │ │ │ │ ├── Configs │ │ │ │ │ ├── AppInfo.xcconfig │ │ │ │ │ ├── Debug.xcconfig │ │ │ │ │ ├── Release.xcconfig │ │ │ │ │ └── Warnings.xcconfig │ │ │ │ ├── DebugProfile.entitlements │ │ │ │ ├── Info.plist │ │ │ │ ├── MainFlutterWindow.swift │ │ │ │ └── Release.entitlements │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── pubspec.yaml │ │ └── test │ │ │ ├── chat_message_test.dart │ │ │ └── transcript_state_test.dart │ ├── ffigen.yaml │ ├── hook │ │ └── build.dart │ ├── lib │ │ ├── interface.dart │ │ ├── io.dart │ │ ├── mediapipe_genai.dart │ │ ├── src │ │ │ ├── interface │ │ │ │ ├── interface.dart │ │ │ │ └── tasks │ │ │ │ │ ├── llm_inference │ │ │ │ │ ├── llm_inference.dart │ │ │ │ │ ├── llm_inference_engine.dart │ │ │ │ │ ├── llm_response_context.dart │ │ │ │ │ └── task_options.dart │ │ │ │ │ └── tasks.dart │ │ │ └── io │ │ │ │ ├── mediapipe_genai.dart │ │ │ │ ├── tasks │ │ │ │ ├── llm_inference │ │ │ │ │ ├── llm_inference.dart │ │ │ │ │ ├── llm_inference_engine.dart │ │ │ │ │ ├── llm_inference_executor.dart │ │ │ │ │ ├── llm_response_context.dart │ │ │ │ │ └── task_options.dart │ │ │ │ └── tasks.dart │ │ │ │ └── third_party │ │ │ │ └── mediapipe │ │ │ │ └── generated │ │ │ │ └── mediapipe_genai_bindings.dart │ │ └── universal_mediapipe_genai.dart │ ├── pubspec.yaml │ ├── sdk_downloads.dart │ ├── test │ │ └── mediapipe_inference_test.dart │ └── third_party │ │ └── mediapipe │ │ └── tasks │ │ └── cc │ │ └── genai │ │ └── inference │ │ └── c │ │ └── llm_inference_engine.h ├── mediapipe-task-text │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── dart_test.yaml │ ├── example │ │ ├── .gitignore │ │ ├── .metadata │ │ ├── README.md │ │ ├── analysis_options.yaml │ │ ├── android │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ │ ├── main │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── res │ │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ ├── build.gradle │ │ │ ├── gradle.properties │ │ │ ├── gradle │ │ │ │ └── wrapper │ │ │ │ │ └── gradle-wrapper.properties │ │ │ └── settings.gradle │ │ ├── ios │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── AppFrameworkInfo.plist │ │ │ │ ├── Debug.xcconfig │ │ │ │ └── Release.xcconfig │ │ │ ├── Podfile │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ ├── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ │ └── LaunchImage.imageset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ │ └── README.md │ │ │ │ ├── Base.lproj │ │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ │ └── Main.storyboard │ │ │ │ ├── Info.plist │ │ │ │ └── Runner-Bridging-Header.h │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── lib │ │ │ ├── enumerate.dart │ │ │ ├── keyboard_hider.dart │ │ │ ├── language_detection_demo.dart │ │ │ ├── logging.dart │ │ │ ├── main.dart │ │ │ ├── text_classification_demo.dart │ │ │ └── text_embedding_demo.dart │ │ ├── macos │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── Flutter-Debug.xcconfig │ │ │ │ └── Flutter-Release.xcconfig │ │ │ ├── Podfile │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ │ └── app_icon_64.png │ │ │ │ ├── Base.lproj │ │ │ │ │ └── MainMenu.xib │ │ │ │ ├── Configs │ │ │ │ │ ├── AppInfo.xcconfig │ │ │ │ │ ├── Debug.xcconfig │ │ │ │ │ ├── Release.xcconfig │ │ │ │ │ └── Warnings.xcconfig │ │ │ │ ├── DebugProfile.entitlements │ │ │ │ ├── Info.plist │ │ │ │ ├── MainFlutterWindow.swift │ │ │ │ └── Release.entitlements │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── pubspec.yaml │ │ └── test │ │ │ └── widgets_test.dart │ ├── ffigen.yaml │ ├── hook │ │ └── build.dart │ ├── lib │ │ ├── interface.dart │ │ ├── io.dart │ │ ├── mediapipe_text.dart │ │ ├── src │ │ │ ├── interface │ │ │ │ ├── interface.dart │ │ │ │ └── tasks │ │ │ │ │ ├── language_detection │ │ │ │ │ ├── language_detection.dart │ │ │ │ │ ├── language_detector.dart │ │ │ │ │ ├── language_detector_options.dart │ │ │ │ │ └── language_detector_result.dart │ │ │ │ │ ├── tasks.dart │ │ │ │ │ ├── text_classification │ │ │ │ │ ├── text_classification.dart │ │ │ │ │ ├── text_classifier.dart │ │ │ │ │ ├── text_classifier_options.dart │ │ │ │ │ └── text_classifier_result.dart │ │ │ │ │ └── text_embedding │ │ │ │ │ ├── text_embedder.dart │ │ │ │ │ ├── text_embedder_options.dart │ │ │ │ │ └── text_embedding.dart │ │ │ ├── io │ │ │ │ ├── mediapipe_text.dart │ │ │ │ ├── tasks │ │ │ │ │ ├── language_detection │ │ │ │ │ │ ├── language_detection.dart │ │ │ │ │ │ ├── language_detector.dart │ │ │ │ │ │ ├── language_detector_executor.dart │ │ │ │ │ │ ├── language_detector_options.dart │ │ │ │ │ │ └── language_detector_result.dart │ │ │ │ │ ├── tasks.dart │ │ │ │ │ ├── text_classification │ │ │ │ │ │ ├── text_classification.dart │ │ │ │ │ │ ├── text_classifier.dart │ │ │ │ │ │ ├── text_classifier_executor.dart │ │ │ │ │ │ ├── text_classifier_options.dart │ │ │ │ │ │ └── text_classifier_result.dart │ │ │ │ │ └── text_embedding │ │ │ │ │ │ ├── text_embedder.dart │ │ │ │ │ │ ├── text_embedder_executor.dart │ │ │ │ │ │ ├── text_embedder_options.dart │ │ │ │ │ │ ├── text_embedder_result.dart │ │ │ │ │ │ └── text_embedding.dart │ │ │ │ └── third_party │ │ │ │ │ └── mediapipe │ │ │ │ │ └── generated │ │ │ │ │ └── mediapipe_text_bindings.dart │ │ │ └── web │ │ │ │ └── mediapipe_text.dart │ │ └── universal_mediapipe_text.dart │ ├── pubspec.yaml │ ├── sdk_downloads.dart │ ├── test │ │ ├── language_detector_executor_test.dart │ │ ├── language_detector_result_test.dart │ │ ├── text_classifier_executor_test.dart │ │ ├── text_classifier_result_test.dart │ │ ├── text_embedder_executor_test.dart │ │ └── text_embedder_result_test.dart │ └── third_party │ │ └── mediapipe │ │ └── tasks │ │ └── c │ │ └── text │ │ ├── language_detector │ │ └── language_detector.h │ │ ├── text_classifier │ │ └── text_classifier.h │ │ └── text_embedder │ │ └── text_embedder.h └── mediapipe-task-vision │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── ffigen.yaml │ ├── lib │ ├── interface.dart │ ├── io.dart │ ├── mediapipe_vision.dart │ ├── src │ │ ├── interface │ │ │ ├── interface.dart │ │ │ └── tasks │ │ │ │ └── tasks.dart │ │ └── io │ │ │ ├── mediapipe_vision.dart │ │ │ └── tasks │ │ │ └── tasks.dart │ ├── third_party │ │ └── mediapipe │ │ │ └── mediapipe_vision_bindings.dart │ └── universal_mediapipe_vision.dart │ ├── pubspec.yaml │ ├── sdk_downloads.dart │ ├── test │ └── mediapipe_vision_test.dart │ └── third_party │ └── mediapipe │ └── tasks │ └── c │ └── vision │ └── image_classifier.h └── tool ├── builder ├── .gitignore ├── CHANGELOG.md ├── README.md ├── analysis_options.yaml ├── bin │ └── main.dart ├── lib │ ├── download_model.dart │ ├── extensions.dart │ ├── repo_finder.dart │ ├── sdks_finder.dart │ └── sync_headers.dart └── pubspec.yaml ├── ci_script_shared.sh ├── mediapipe_ci_script_beta.sh ├── mediapipe_ci_script_master.sh └── mediapipe_ci_script_stable.sh /.flutter-mediapipe-root: -------------------------------------------------------------------------------- 1 | // Used to normalize the paths of commands. 2 | // The contents of this file do not matter. 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "⚠️ Bug Report" 3 | about: Report a bug with existing Flutter MediaPipe features. 4 | title: "\U0001F41B [PLUGIN_NAME_HERE] Your issue title here" 5 | labels: 'Needs Attention, type: bug' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Bug report 11 | 12 | **Describe the bug** 13 | A clear and concise description of what the bug is. 14 | 15 | ### Steps to reproduce 16 | 17 | Steps to reproduce the behavior: 18 | 19 | 1. Go to '...' 20 | 2. '...' 21 | 4. See error or incorrect behavior 22 | 23 | ### Expected behavior 24 | 25 | A clear and concise description of what you expected to happen. 26 | 27 | ### Sample project 28 | 29 | Providing a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) project which demonstrates the bug in isolation from your main App _greatly_ enhances the chance of a timely fix. 30 | Please link to the public repository URL. 31 | 32 | --- 33 | 34 | ## Additional context 35 | 36 | Add any other context about the problem here. 37 | 38 | --- 39 | 40 | ### Flutter doctor 41 | 42 | Run `flutter doctor` and paste the output below: 43 | 44 |
Click To Expand 45 | 46 | ``` 47 | PASTE OUTPUT INSIDE HERE 48 | ``` 49 | 50 |
51 | 52 | --- 53 | 54 | ### Flutter dependencies 55 | 56 | Run `flutter pub deps -- --style=compact` and paste the output below: 57 | 58 |
Click To Expand 59 | 60 | ``` 61 | PASTE OUTPUT INSIDE HERE 62 | ``` 63 | 64 |
65 | 66 | --- 67 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---documentation-feedback.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4DA Documentation Feedback" 3 | about: Report an issue with the relevant MediaPipe documentation or suggest an improvement. 4 | title: "[\U0001F4DA] Your documentation feedback title (CHANGE ME)" 5 | labels: 'good first issue, type: documentation' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please describe your documentation issue or suggested improvement in detail here and provide links to any pre-existing/relevant documentation and screenshots if necessary: 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Feature Request 4 | url: https://github.com/google/flutter-mediapipe/discussions/new?category=feature-request 5 | about: Share ideas for new features. 6 | - name: Ask a Question 7 | url: https://github.com/google/flutter-mediapipe/discussions/new?category=q-a 8 | about: Ask the community for help. 9 | - name: Show and tell 10 | url: https://github.com/google/flutter-mediapipe/discussions/new?category=show-and-tell 11 | about: Share what you've built with FlutterFire. 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | *Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change.* 4 | 5 | ## Related Issues 6 | 7 | *Replace this paragraph with a list of issues related to this PR from the [issue database](https://github.com/google/flutter-mediapipe/issues). Indicate, which of these issues are resolved or fixed by this PR. Note that you'll have to prefix the issue numbers with flutter/flutter#.* 8 | 9 | ## Checklist 10 | 11 | Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (`[x]`). 12 | This will ensure a smooth and quick review process. Updating the `pubspec.yaml` and changelogs is not required. 13 | 14 | - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. 15 | - [ ] My PR includes unit or integration tests for *all* changed/updated/fixed behaviors (See [Contributor Guide]). 16 | - [ ] All existing and new tests are passing. 17 | - [ ] I updated/added relevant documentation (doc comments with `///`). 18 | - [ ] The analyzer (`melos run analyze`) does not report any problems on my PR. 19 | - [ ] I read and followed the [Flutter Style Guide]. 20 | - [ ] I signed the [CLA]. 21 | - [ ] I am willing to follow-up on review comments in a timely manner. 22 | 23 | ## Breaking Change 24 | 25 | Does your PR require plugin users to manually update their apps to accommodate your change? 26 | 27 | - [ ] Yes, this is a breaking change. 28 | - [ ] No, this is *not* a breaking change. 29 | 30 | 31 | [issue database]: https://github.com/google/flutter-mediapipe/issues 32 | [Contributor Guide]: https://github.com/google/flutter-mediapipe/blob/master/CONTRIBUTING.md 33 | [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo 34 | [pub versioning philosophy]: https://dart.dev/tools/pub/versioning 35 | [CLA]: https://cla.developers.google.com/ 36 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Dependabot configuration file. 2 | # See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: github-actions 7 | directory: / 8 | schedule: 9 | interval: monthly 10 | -------------------------------------------------------------------------------- /.github/workflows/builder.yaml: -------------------------------------------------------------------------------- 1 | name: builder 2 | 3 | # Declare default permissions as read only. 4 | permissions: read-all 5 | 6 | on: 7 | pull_request: 8 | branches: [main] 9 | push: 10 | branches: [main] 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | defaults: 16 | run: 17 | working-directory: tool/builder 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | sdk: [stable] 22 | steps: 23 | - uses: actions/checkout@v4 24 | - uses: dart-lang/setup-dart@v1 25 | with: 26 | sdk: ${{ matrix.sdk }} 27 | 28 | - run: dart pub get 29 | 30 | - run: dart analyze --fatal-infos 31 | 32 | - run: dart format --output=none --set-exit-if-changed . 33 | if: ${{ matrix.sdk == 'stable' }} 34 | 35 | # Ensure the tool can run without errors. 36 | - run: dart bin/main.dart -h 37 | -------------------------------------------------------------------------------- /.github/workflows/main.yaml: -------------------------------------------------------------------------------- 1 | name: Main Branch CI 2 | 3 | # Declare default permissions as read only. 4 | permissions: read-all 5 | 6 | on: 7 | pull_request: 8 | branches: [] 9 | push: 10 | branches: [main, ffi-wrapper, ffi-wrapper-text-pkg] 11 | 12 | defaults: 13 | run: 14 | shell: bash 15 | 16 | jobs: 17 | flutter-tests: 18 | name: Test mediapipe_core against ${{ matrix.flutter_version }} 19 | runs-on: ${{ matrix.os }} 20 | # Skip running job on forks 21 | if: github.repository == 'google/flutter-mediapipe' 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | flutter_version: [master] 26 | # TODO(craiglabenz): reverse once CI works 27 | # flutter_version: [stable, beta, master] 28 | # TODO(craiglabenz): Add `ubuntu-latest` and `windows-latest` when those artifacts exist 29 | os: [macos-latest] 30 | steps: 31 | - uses: actions/checkout@v4 32 | - uses: subosito/flutter-action@v2 33 | with: 34 | channel: ${{ matrix.flutter_version }} 35 | - run: ./tool/mediapipe_ci_script_${{ matrix.flutter_version }}.sh 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .idea/ 4 | .vscode/* 5 | .melos_tool/* 6 | !.vscode/tasks.json 7 | !.vscode/settings.json 8 | 9 | .packages 10 | .pub/ 11 | .dart_tool/ 12 | pubspec.lock 13 | pubspec_overrides.yaml 14 | flutter_export_environment.sh 15 | 16 | examples/all_plugins/pubspec.yaml 17 | 18 | Podfile.lock 19 | Pods/ 20 | .symlinks/ 21 | **/Flutter/ephemeral/ 22 | **/Flutter/Flutter.podspec 23 | **/Flutter/App.framework/ 24 | **/Flutter/Flutter.framework/ 25 | **/Flutter/Generated.xcconfig 26 | **/Flutter/flutter_assets/ 27 | ServiceDefinitions.json 28 | xcuserdata/ 29 | 30 | local.properties 31 | keystore.properties 32 | .gradle/ 33 | gradlew 34 | gradlew.bat 35 | gradle-wrapper.jar 36 | *.iml 37 | 38 | GeneratedPluginRegistrant.h 39 | GeneratedPluginRegistrant.m 40 | GeneratedPluginRegistrant.java 41 | GeneratedPluginRegistrant.swift 42 | generated_plugin_registrant.dart 43 | 44 | build/ 45 | .flutter-plugins 46 | .flutter-plugins-dependencies 47 | 48 | .project 49 | .classpath 50 | .settings 51 | .last_build_id 52 | 53 | # Docs 54 | 55 | # Dependencies 56 | node_modules 57 | 58 | # Production 59 | website/build 60 | 61 | # Generated files 62 | .docusaurus 63 | .cache-loader 64 | 65 | # Misc 66 | .env.local 67 | .env.development.local 68 | .env.test.local 69 | .env.production.local 70 | 71 | npm-debug.log* 72 | yarn-debug.log* 73 | yarn-error.log* -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "base_options.h": "c", 4 | "__config": "c", 5 | "text_classifier.h": "c", 6 | "category.h": "c" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Below is a list of people and organizations that have contributed 2 | # to the Flutter project. Names should be added to the list like so: 3 | # 4 | # Name/Organization 5 | 6 | Google Inc. 7 | Paul Ruiz -------------------------------------------------------------------------------- /assets/empty-models.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/assets/empty-models.png -------------------------------------------------------------------------------- /assets/no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/assets/no.png -------------------------------------------------------------------------------- /assets/yes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/assets/yes.png -------------------------------------------------------------------------------- /packages/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml 2 | 3 | linter: 4 | rules: 5 | - public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc 6 | 7 | -------------------------------------------------------------------------------- /packages/mediapipe-core/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | 5 | # Avoid committing pubspec.lock for library packages; see 6 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 7 | pubspec.lock 8 | -------------------------------------------------------------------------------- /packages/mediapipe-core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-core/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023, the MediaPipe project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /packages/mediapipe-core/README.md: -------------------------------------------------------------------------------- 1 | # MediaPipe Core for Flutter 2 | 3 | ![pub package](https://img.shields.io/pub/v/mediapipe_core) 4 | 5 | A Flutter plugin to use the MediaPipe Core API, which enables multiple Mediapipe tasks. 6 | 7 | To learn more about MediaPipe, please visit the [MediaPipe website](https://developers.google.com/mediapipe) 8 | 9 | ## Getting Started 10 | 11 | To get started with MediaPipe, please [see the documentation](https://developers.google.com/mediapipe/solutions/guide). 12 | 13 | 18 | 19 | ## Issues and feedback 20 | 21 | Please file Flutter-MediaPipe specific issues, bugs, or feature requests in our [issue tracker](https://github.com/google/flutter-mediapipe/issues/new). 22 | 23 | Issues that are specific to Flutter can be filed in the [Flutter issue tracker](https://github.com/flutter/flutter/issues/new). 24 | 25 | To contribute a change to this plugin, 26 | please review our [contribution guide](https://github.com/google/flutter-mediapipe/blob/master/CONTRIBUTING.md) 27 | and open a [pull request](https://github.com/google/flutter-mediapipe/pulls). 28 | -------------------------------------------------------------------------------- /packages/mediapipe-core/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | - public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc 6 | 7 | analyzer: 8 | exclude: 9 | - "**/mediapipe_common_bindings.dart" 10 | -------------------------------------------------------------------------------- /packages/mediapipe-core/ffigen.yaml: -------------------------------------------------------------------------------- 1 | name: "MediaPipeCommonBindings" 2 | description: "Bindings for shared MediaPipe structs common across many tasks" 3 | output: 4 | bindings: "lib/src/io/third_party/mediapipe/generated/mediapipe_common_bindings.dart" 5 | symbol-file: 6 | output: "package:mediapipe_core/generated/core_symbols.yaml" 7 | import-path: "package:mediapipe_core/src/io/third_party/mediapipe/generated/mediapipe_common_bindings.dart" 8 | headers: 9 | entry-points: 10 | - "third_party/mediapipe/tasks/c/**.h" 11 | preamble: | 12 | /* Copyright 2023 The MediaPipe Authors. 13 | 14 | Licensed under the Apache License, Version 2.0 (the "License"); 15 | you may not use this file except in compliance with the License. 16 | You may obtain a copy of the License at 17 | 18 | http://www.apache.org/licenses/LICENSE-2.0 19 | 20 | Unless required by applicable law or agreed to in writing, software 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | ==============================================================================*/ 26 | ffi-native: 27 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/generated/core_symbols.yaml: -------------------------------------------------------------------------------- 1 | format_version: 1.0.0 2 | files: 3 | package:mediapipe_core/src/io/third_party/mediapipe/generated/mediapipe_common_bindings.dart: 4 | used-config: 5 | ffi-native: false 6 | symbols: 7 | c:@S@BaseOptions: 8 | name: BaseOptions 9 | c:@S@Categories: 10 | name: Categories 11 | c:@S@Category: 12 | name: Category 13 | c:@S@ClassificationResult: 14 | name: ClassificationResult 15 | c:@S@Classifications: 16 | name: Classifications 17 | c:@S@ClassifierOptions: 18 | name: ClassifierOptions 19 | c:@S@EmbedderOptions: 20 | name: EmbedderOptions 21 | c:@S@Embedding: 22 | name: Embedding 23 | c:@S@EmbeddingResult: 24 | name: EmbeddingResult 25 | c:@S@__darwin_pthread_handler_rec: 26 | name: __darwin_pthread_handler_rec 27 | c:@S@_opaque_pthread_attr_t: 28 | name: _opaque_pthread_attr_t 29 | c:@S@_opaque_pthread_cond_t: 30 | name: _opaque_pthread_cond_t 31 | c:@S@_opaque_pthread_condattr_t: 32 | name: _opaque_pthread_condattr_t 33 | c:@S@_opaque_pthread_mutex_t: 34 | name: _opaque_pthread_mutex_t 35 | c:@S@_opaque_pthread_mutexattr_t: 36 | name: _opaque_pthread_mutexattr_t 37 | c:@S@_opaque_pthread_once_t: 38 | name: _opaque_pthread_once_t 39 | c:@S@_opaque_pthread_rwlock_t: 40 | name: _opaque_pthread_rwlock_t 41 | c:@S@_opaque_pthread_rwlockattr_t: 42 | name: _opaque_pthread_rwlockattr_t 43 | c:@S@_opaque_pthread_t: 44 | name: _opaque_pthread_t 45 | c:@UA@__mbstate_t: 46 | name: __mbstate_t 47 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/interface/interface.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/io.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/interface/containers.dart' show EmbeddingType; 6 | export 'src/io/mediapipe_core.dart'; 7 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/mediapipe_core.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Package containing core dependencies for MediaPipe's text, vision, and 6 | /// audio-based tasks. 7 | library mediapipe_core; 8 | 9 | export 'src/extensions.dart'; 10 | export 'src/ffi_utils.dart'; 11 | export 'src/interface/containers.dart' show EmbeddingType; 12 | export 'universal_mediapipe_core.dart' 13 | if (dart.library.html) 'src/web/mediapipe_core.dart' 14 | if (dart.library.io) 'src/io/mediapipe_core.dart'; 15 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/src/extensions.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Shortens long strings for logging, printing, etc. 6 | extension DebuggableString on String { 7 | /// Shortens the string to its first X characters, replacing the rest with an 8 | /// ellipses and the total length. If the string is equal to or shorter than 9 | /// the given length, then [shorten] is a no-op. 10 | String shorten([int x = 10]) { 11 | if (length <= x) return this; 12 | return '${substring(0, x)}...[$length]'; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/src/interface/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'containers.dart'; 6 | export 'task_options.dart'; 7 | export 'task_result.dart'; 8 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/src/io/mediapipe_core.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'containers.dart'; 6 | export 'ffi_utils.dart'; 7 | export 'task_options.dart'; 8 | export 'task_executor.dart'; 9 | export 'task_result.dart'; 10 | -------------------------------------------------------------------------------- /packages/mediapipe-core/lib/src/web/mediapipe_core.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-core/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mediapipe_core 2 | description: Shared logic and utilities required by other MediaPipe Task packages. 3 | version: 0.0.1+1 4 | 5 | repository: https://github.com/google/flutter-mediapipe/tree/main/packages/mediapipe-core 6 | issue_tracker: https://github.com/google/flutter-mediapipe/issues 7 | 8 | platforms: 9 | android: 10 | ios: 11 | linux: 12 | macos: 13 | # web: 14 | windows: 15 | 16 | environment: 17 | # For now, `native-assets` is a Flutter experiment, which can only be 18 | # enabled on the `master` channel. 19 | sdk: ^3.4.0 20 | 21 | # Add regular dependencies here. 22 | dependencies: 23 | equatable: ^2.0.5 24 | ffi: ^2.1.2 25 | logging: ^1.2.0 26 | meta: ^1.12.0 27 | 28 | dev_dependencies: 29 | ffigen: ^12.0.0 30 | flutter_lints: ^2.0.0 31 | test: ^1.21.0 32 | -------------------------------------------------------------------------------- /packages/mediapipe-core/third_party/mediapipe/tasks/c/components/containers/category.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The MediaPipe Authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef MEDIAPIPE_TASKS_C_COMPONENTS_CONTAINERS_CATEGORY_H_ 17 | #define MEDIAPIPE_TASKS_C_COMPONENTS_CONTAINERS_CATEGORY_H_ 18 | 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | // Defines a single classification result. 26 | // 27 | // The label maps packed into the TFLite Model Metadata [1] are used to populate 28 | // the 'category_name' and 'display_name' fields. 29 | // 30 | // [1]: https://www.tensorflow.org/lite/convert/metadata 31 | struct Category { 32 | // The index of the category in the classification model output. 33 | int index; 34 | 35 | // The score for this category, e.g. (but not necessarily) a probability in 36 | // [0,1]. 37 | float score; 38 | 39 | // The optional ID for the category, read from the label map packed in the 40 | // TFLite Model Metadata if present. Not necessarily human-readable. 41 | char* category_name; 42 | 43 | // The optional human-readable name for the category, read from the label map 44 | // packed in the TFLite Model Metadata if present. 45 | char* display_name; 46 | }; 47 | 48 | // A list of categories. 49 | struct Categories { 50 | struct Category* categories; 51 | uint32_t categories_count; 52 | }; 53 | 54 | #ifdef __cplusplus 55 | } // extern C 56 | #endif 57 | 58 | #endif // MEDIAPIPE_TASKS_C_COMPONENTS_CONTAINERS_CATEGORY_H_ 59 | -------------------------------------------------------------------------------- /packages/mediapipe-core/third_party/mediapipe/tasks/c/components/processors/embedder_options.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The MediaPipe Authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef MEDIAPIPE_TASKS_C_COMPONENTS_PROCESSORS_EMBEDDER_OPTIONS_H_ 17 | #define MEDIAPIPE_TASKS_C_COMPONENTS_PROCESSORS_EMBEDDER_OPTIONS_H_ 18 | 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | // Embedder options for MediaPipe C embedding extraction tasks. 26 | struct EmbedderOptions { 27 | // Whether to normalize the returned feature vector with L2 norm. Use this 28 | // option only if the model does not already contain a native L2_NORMALIZATION 29 | // TF Lite Op. In most cases, this is already the case and L2 norm is thus 30 | // achieved through TF Lite inference. 31 | bool l2_normalize; 32 | 33 | // Whether the returned embedding should be quantized to bytes via scalar 34 | // quantization. Embeddings are implicitly assumed to be unit-norm and 35 | // therefore any dimension is guaranteed to have a value in [-1.0, 1.0]. Use 36 | // the l2_normalize option if this is not the case. 37 | bool quantize; 38 | }; 39 | 40 | #ifdef __cplusplus 41 | } // extern C 42 | #endif 43 | 44 | #endif // MEDIAPIPE_TASKS_C_COMPONENTS_PROCESSORS_EMBEDDER_OPTIONS_H_ 45 | -------------------------------------------------------------------------------- /packages/mediapipe-core/third_party/mediapipe/tasks/c/core/base_options.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The MediaPipe Authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef MEDIAPIPE_TASKS_C_CORE_BASE_OPTIONS_H_ 17 | #define MEDIAPIPE_TASKS_C_CORE_BASE_OPTIONS_H_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | // Base options for MediaPipe C Tasks. 24 | struct BaseOptions { 25 | // The model asset file contents as bytes. 26 | const char* model_asset_buffer; 27 | 28 | // The size of the model assets buffer (or `0` if not set). 29 | unsigned int model_asset_buffer_count; 30 | 31 | // The path to the model asset to open and mmap in memory. 32 | const char* model_asset_path; 33 | }; 34 | 35 | #ifdef __cplusplus 36 | } // extern C 37 | #endif 38 | 39 | #endif // MEDIAPIPE_TASKS_C_CORE_BASE_OPTIONS_H_ 40 | -------------------------------------------------------------------------------- /packages/mediapipe-task-audio/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023, the MediaPipe project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /packages/mediapipe-task-audio/README.md: -------------------------------------------------------------------------------- 1 | # mediapipe_task_audio 2 | 3 | A new Flutter plugin project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter 8 | [plug-in package](https://flutter.dev/developing-packages/), 9 | a specialized package that includes platform-specific implementation code for 10 | Android and/or iOS. 11 | 12 | For help getting started with Flutter development, view the 13 | [online documentation](https://flutter.dev/docs), which offers tutorials, 14 | samples, guidance on mobile development, and a full API reference. 15 | 16 | -------------------------------------------------------------------------------- /packages/mediapipe-task-audio/sdk_downloads.dart: -------------------------------------------------------------------------------- 1 | // Generated file. Do not manually edit. 2 | // Used by the flutter toolchain (via build.dart) during compilation of any 3 | // Flutter app using this package. 4 | final Map>> sdkDownloadUrls = {}; 5 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | build/ 30 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "bd909542a33ab1d5249363a2434ae50ee468094f" 8 | channel: "master" 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023, the MediaPipe project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | - public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc 6 | 7 | analyzer: 8 | exclude: 9 | - "**/mediapipe_genai_bindings.dart" 10 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "86135b7774e32fa7b0ad0d116511471f36048579" 8 | channel: "master" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 86135b7774e32fa7b0ad0d116511471f36048579 17 | base_revision: 86135b7774e32fa7b0ad0d116511471f36048579 18 | - platform: ios 19 | create_revision: 86135b7774e32fa7b0ad0d116511471f36048579 20 | base_revision: 86135b7774e32fa7b0ad0d116511471f36048579 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Flutter", 5 | "request": "launch", 6 | "type": "dart", 7 | "env": { 8 | "GEMMA_4B_CPU_URI": "https://storage.googleapis.com/random-storage-asdf/gemma/gemma-2b-it-cpu-int4.bin", 9 | "GEMMA_4B_GPU_URI": "https://storage.googleapis.com/random-storage-asdf/gemma/gemma-2b-it-gpu-int4.bin", 10 | "GEMMA_8B_CPU_URI": "https://storage.googleapis.com/random-storage-asdf/gemma/gemma-2b-it-cpu-int8.bin", 11 | "GEMMA_8B_GPU_URI": "https://storage.googleapis.com/random-storage-asdf/gemma/gemma-2b-it-gpu-int8.bin", 12 | }, 13 | "toolArgs": [] 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "com.example.example" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | defaultConfig { 19 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 20 | applicationId = "com.example.example" 21 | // You can update the following values to match your application needs. 22 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 23 | minSdk = flutter.minSdkVersion 24 | targetSdk = flutter.targetSdkVersion 25 | versionCode = flutter.versionCode 26 | versionName = flutter.versionName 27 | } 28 | 29 | buildTypes { 30 | release { 31 | // TODO: Add your own signing config for the release build. 32 | // Signing with the debug keys for now, so `flutter run --release` works. 33 | signingConfig = signingConfigs.debug 34 | } 35 | } 36 | } 37 | 38 | flutter { 39 | source = "../.." 40 | } 41 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.3.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Example 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | example 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | UIApplicationSupportsIndirectInputEvents 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/logging.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:io' as io; 6 | import 'package:logging/logging.dart'; 7 | 8 | final log = Logger('Genai'); 9 | 10 | void initLogging() { 11 | Logger.root.level = Level.FINER; 12 | Logger.root.onRecord.listen((record) { 13 | io.stdout.writeln('${record.level.name} [${record.loggerName}]' 14 | '[' 15 | '${record.time.hour.toString()}:' 16 | '${record.time.minute.toString().padLeft(2, "0")}:' 17 | '${record.time.second.toString().padLeft(2, "0")}.' 18 | '${record.time.millisecond.toString().padRight(3, "0")}' 19 | '] ${record.message}'); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/model_storage/model_storage.dart: -------------------------------------------------------------------------------- 1 | export 'model_storage_interface.dart'; 2 | 3 | export 'universal_model_storage.dart' 4 | if (dart.library.html) 'web_model_storage.dart' 5 | if (dart.library.io) 'io_model_storage.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/model_storage/universal_model_storage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:example/models/models.dart'; 4 | 5 | import 'model_storage_interface.dart'; 6 | 7 | class ModelStorage extends ModelStorageInterface { 8 | @override 9 | int binarySize(String location) => throw UnimplementedError(); 10 | 11 | @override 12 | Future downloadExists(String downloadLocation) => 13 | throw UnimplementedError(); 14 | 15 | @override 16 | Future urlToDownloadDestination(Uri location) async => 17 | throw UnimplementedError(); 18 | 19 | @override 20 | Future abort(String location) => throw UnimplementedError(); 21 | 22 | @override 23 | Future close(String location) => throw UnimplementedError(); 24 | 25 | @override 26 | Future delete(LlmModel model) => throw UnimplementedError(); 27 | 28 | @override 29 | Future>> create(String location) => 30 | throw UnimplementedError(); 31 | } 32 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/models/models.dart: -------------------------------------------------------------------------------- 1 | export 'chat_message.dart'; 2 | export 'llm_model.dart'; 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/widgets/chat_input.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ChatInput extends StatelessWidget { 4 | const ChatInput({ 5 | required this.submit, 6 | required this.controller, 7 | required this.isLlmTyping, 8 | super.key, 9 | }); 10 | 11 | final TextEditingController controller; 12 | 13 | final void Function(String) submit; 14 | 15 | /// Prevents submitting new messages when true. 16 | final bool isLlmTyping; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Row( 21 | children: [ 22 | Expanded(child: TextField(controller: controller)), 23 | ValueListenableBuilder( 24 | valueListenable: controller, 25 | builder: (context, value, child) { 26 | return IconButton( 27 | icon: const Icon(Icons.send), 28 | onPressed: controller.text != '' && !isLlmTyping 29 | ? () { 30 | submit(controller.text); 31 | controller.clear(); 32 | } 33 | : null, 34 | ); 35 | }, 36 | ), 37 | ], 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/widgets/keyboard_hider.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter/widgets.dart'; 7 | 8 | class KeyboardHider extends StatelessWidget { 9 | const KeyboardHider({required this.child, super.key}); 10 | 11 | final Widget? child; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return GestureDetector( 16 | onTap: () { 17 | // Not sure why this one isn't working. 18 | // FocusScope.of(context).unfocus(); 19 | SystemChannels.textInput.invokeMethod('TextInput.hide'); 20 | }, 21 | child: child, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/lib/widgets/widgets.dart: -------------------------------------------------------------------------------- 1 | export 'chat_input.dart'; 2 | export 'chat_screen.dart'; 3 | export 'configuration_panel.dart'; 4 | export 'keyboard_hider.dart'; 5 | export 'typing_indicator.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.15' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-genai/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.files.downloads.read-only 10 | 11 | com.apple.security.files.user-selected.read-only 12 | 13 | com.apple.security.network.client 14 | 15 | com.apple.security.network.server 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/test/chat_message_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:example/models/models.dart'; 6 | import 'package:flutter_test/flutter_test.dart'; 7 | import 'package:freezed_annotation/freezed_annotation.dart'; 8 | 9 | void main() { 10 | group('ChatMessage should', () { 11 | test('have collection equality', () { 12 | final message = ChatMessage.user(''); 13 | final message2 = ChatMessage.llm(''); 14 | expect( 15 | const DeepCollectionEquality().hash([message]), 16 | const DeepCollectionEquality().hash([message]), 17 | ); 18 | expect( 19 | const DeepCollectionEquality().hash([message]), 20 | isNot(equals(const DeepCollectionEquality().hash([message2]))), 21 | ); 22 | }); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/example/test/transcript_state_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:example/models/models.dart'; 6 | import 'package:example/bloc.dart'; 7 | import 'package:flutter_test/flutter_test.dart'; 8 | 9 | void main() { 10 | group('TranscriptState should', () { 11 | test('have a new hash code after receiving a new message', () { 12 | final initial = TranscriptState.initial(); 13 | final updated = initial.addMessage( 14 | ChatMessage.user('Hello'), 15 | LlmModel.gemma4bCpu, 16 | ); 17 | expect(initial.transcript, isNot(equals(updated.transcript))); 18 | expect( 19 | initial.transcript.hashCode, 20 | isNot(equals(updated.transcript.hashCode)), 21 | ); 22 | expect(initial.hashCode, isNot(equals(updated.hashCode))); 23 | }); 24 | 25 | test('have a new hash code after extending a message', () { 26 | var initial = TranscriptState.initial(); 27 | initial = initial.addMessage( 28 | ChatMessage.llm('Hello'), 29 | LlmModel.gemma4bCpu, 30 | ); 31 | final updated = initial.extendMessage( 32 | ', world!', 33 | index: 0, 34 | model: LlmModel.gemma4bCpu, 35 | first: false, 36 | last: true, 37 | ); 38 | expect(initial.transcript, isNot(equals(updated.transcript))); 39 | expect( 40 | initial.transcript.hashCode, 41 | isNot(equals(updated.transcript.hashCode)), 42 | ); 43 | expect(initial.hashCode, isNot(equals(updated.hashCode))); 44 | }); 45 | 46 | test('have a new hash code after extending a message', () { 47 | var initial = TranscriptState.initial(); 48 | initial = initial.addMessage( 49 | ChatMessage.llm('Hello'), 50 | LlmModel.gemma4bCpu, 51 | ); 52 | final updated = initial.completeMessage(LlmModel.gemma4bCpu); 53 | expect(initial.transcript, isNot(equals(updated.transcript))); 54 | expect( 55 | initial.transcript.hashCode, 56 | isNot(equals(updated.transcript.hashCode)), 57 | ); 58 | expect(initial.hashCode, isNot(equals(updated.hashCode))); 59 | }); 60 | }); 61 | } 62 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/ffigen.yaml: -------------------------------------------------------------------------------- 1 | name: "MediaPipeGenAiBindings" 2 | description: "Bindings for MediaPipe GenAI tasks" 3 | output: 4 | bindings: "lib/src/io/third_party/mediapipe/generated/mediapipe_genai_bindings.dart" 5 | headers: 6 | entry-points: 7 | - "third_party/mediapipe/tasks/cc/**.h" 8 | preamble: | 9 | /* Copyright 2023 The MediaPipe Authors. 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | ==============================================================================*/ 23 | ffi-native: 24 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/interface/interface.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/io.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/io/mediapipe_genai.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/mediapipe_genai.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Package containing core dependencies for MediaPipe's text, vision, and 6 | /// audio-based tasks. 7 | library mediapipe_core; 8 | 9 | export 'universal_mediapipe_genai.dart' 10 | if (dart.library.html) 'src/web/mediapipe_genai.dart' 11 | if (dart.library.io) 'src/io/mediapipe_genai.dart'; 12 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/interface/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'tasks/tasks.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/interface/tasks/llm_inference/llm_inference.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'llm_inference_engine.dart'; 6 | export 'llm_response_context.dart'; 7 | export 'task_options.dart'; 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/interface/tasks/llm_inference/llm_inference_engine.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// {@template LlmInferenceEngine} 6 | /// Utility to query an LLM with a prompt and receive its response as a stream. 7 | /// {@endtemplate} 8 | abstract class BaseLlmInferenceEngine { 9 | /// {@template generateResponse} 10 | /// Generates a response based on the input text. 11 | /// {@endtemplate} 12 | Stream generateResponse(String text); 13 | 14 | /// {@template sizeInTokens} 15 | /// Runs an invocation of only the tokenization for the LLM, and returns the 16 | /// size (in tokens) of the result. 17 | /// {@endtemplate} 18 | Future sizeInTokens(String text); 19 | } 20 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/interface/tasks/llm_inference/llm_response_context.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | 7 | /// {@template LlmResponseContext} 8 | /// Represents all of or part of an LLM's response to a query. 9 | /// {@endtemplate} 10 | abstract class BaseLlmResponseContext extends TaskResult { 11 | /// The core of the LLM's response from this query. If the asynchronous 12 | /// API is used, this [response] value should be chained with subsequent 13 | /// values until the LLM emits one with [isDone] set to true. 14 | List get responseArray; 15 | 16 | /// Indicates when an LLM is done responding. Only useful when calling the 17 | /// asynchronous methods. 18 | bool get isDone; 19 | 20 | @override 21 | String toString() { 22 | return '$runtimeType(responseArray=$responseArray, isDone: $isDone)'; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/interface/tasks/tasks.dart: -------------------------------------------------------------------------------- 1 | export 'llm_inference/llm_inference.dart'; 2 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/io/mediapipe_genai.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'tasks/tasks.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/io/tasks/llm_inference/llm_inference.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'llm_inference_engine.dart'; 6 | export 'llm_inference_executor.dart'; 7 | export 'llm_response_context.dart'; 8 | export 'task_options.dart'; 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/lib/src/io/tasks/tasks.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'llm_inference/llm_inference.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mediapipe_genai 2 | description: An implementation of MediaPipe generative AI-based Tasks. 3 | version: 0.0.1 4 | 5 | repository: https://github.com/google/flutter-mediapipe/tree/main/packages/mediapipe-task-genai 6 | issue_tracker: https://github.com/google/flutter-mediapipe/issues 7 | 8 | platforms: 9 | android: 10 | ios: 11 | # linux: 12 | macos: 13 | # web: 14 | # windows: 15 | 16 | environment: 17 | # For now, `native-assets` is a Flutter experiment, which can only be 18 | # enabled on the `master` channel. 19 | sdk: ^3.4.0 20 | 21 | dependencies: 22 | async: ^2.11.0 23 | equatable: ^2.0.5 24 | ffi: ^2.1.2 25 | http: ^1.1.0 26 | logging: ^1.2.0 27 | mediapipe_core: ^0.0.1 28 | native_assets_cli: ^0.6.0 29 | native_toolchain_c: ^0.4.2 30 | path: ^1.8.3 31 | 32 | dev_dependencies: 33 | ffigen: ^12.0.0 34 | flutter_lints: ^2.0.0 35 | test: ^1.21.0 36 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/sdk_downloads.dart: -------------------------------------------------------------------------------- 1 | // Generated file. Do not manually edit. 2 | // Used by the flutter toolchain (via build.dart) during compilation of any 3 | // Flutter app using this package. 4 | final Map>> sdkDownloadUrls = { 5 | 'android': { 6 | 'libllm_inference_engine': { 7 | 'arm64': 8 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/gcp_ubuntu_flutter/release/40/20240419-150307/android_arm64/libllm_inference_engine.so' 9 | } 10 | }, 11 | 'macos': { 12 | 'libllm_inference_engine': { 13 | 'arm64': 14 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/darwin_arm64/libllm_inference_engine.dylib' 15 | } 16 | }, 17 | 'ios': { 18 | 'libllm_inference_engine': { 19 | 'arm64': 20 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/ios_arm64/libllm_inference_engine.dylib' 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /packages/mediapipe-task-genai/test/mediapipe_inference_test.dart: -------------------------------------------------------------------------------- 1 | void main() {} 2 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | 32 | 33 | # Test artifacts (these are re-compiled before running tests) 34 | test/c/fake_text_classifier 35 | test/c/fake_text_classifier.dylib 36 | test/c/fake_text_classifier.o 37 | 38 | **/assets/libtext_classifier.dylib 39 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "efbf63d9c66b9f6ec30e9ad4611189aa80003d31" 8 | channel: "stable" 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023, the MediaPipe project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /packages/mediapipe-task-text/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | - public_member_api_docs # see https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#documentation-dartdocs-javadocs-etc 6 | 7 | analyzer: 8 | exclude: 9 | - "**/mediapipe_text_bindings.dart" 10 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/dart_test.yaml: -------------------------------------------------------------------------------- 1 | tags: 2 | # Integration tests that talk to C code bundled via the native-assets feature 3 | native-assets: 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | 45 | assets/** 46 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "995a020e48aa6627ea3f904a59dd56349a819eb4" 8 | channel: "master" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 995a020e48aa6627ea3f904a59dd56349a819eb4 17 | base_revision: 995a020e48aa6627ea3f904a59dd56349a819eb4 18 | - platform: android 19 | create_revision: 995a020e48aa6627ea3f904a59dd56349a819eb4 20 | base_revision: 995a020e48aa6627ea3f904a59dd56349a819eb4 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.example" 27 | compileSdk flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.example" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | } 19 | 20 | plugins { 21 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 22 | id "com.android.application" version "7.3.0" apply false 23 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 24 | } 25 | 26 | include ":app" 27 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Example 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | example 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | UIApplicationSupportsIndirectInputEvents 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/lib/enumerate.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | extension EnumeratableList on List { 6 | /// Invokes the callback on each element of the list, optionally stopping 7 | /// after [max] (inclusive) invocations. 8 | Iterable enumerate(S Function(T, int) fn, {int? max}) sync* { 9 | int count = 0; 10 | while (count < length) { 11 | yield fn(this[count], count); 12 | count++; 13 | 14 | if (max != null && count >= max) { 15 | return; 16 | } 17 | } 18 | } 19 | } 20 | 21 | extension EnumeratableIterable on Iterable { 22 | /// Invokes the callback on each element of the iterable, optionally stopping 23 | /// after [max] (inclusive) invocations. 24 | Iterable enumerate(S Function(T, int) fn, {int? max}) sync* { 25 | int count = 0; 26 | for (final T obj in this) { 27 | yield fn(obj, count); 28 | count++; 29 | 30 | if (max != null && count >= max) { 31 | return; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/lib/keyboard_hider.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter/widgets.dart'; 7 | 8 | class KeyboardHider extends StatelessWidget { 9 | const KeyboardHider({required this.child, super.key}); 10 | 11 | final Widget? child; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return GestureDetector( 16 | onTap: () { 17 | // Not sure why this one isn't working. 18 | // FocusScope.of(context).unfocus(); 19 | SystemChannels.textInput.invokeMethod('TextInput.hide'); 20 | }, 21 | child: child, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/lib/logging.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:io' as io; 6 | import 'package:logging/logging.dart'; 7 | 8 | final log = Logger('TextTask'); 9 | 10 | void initLogging() { 11 | Logger.root.level = Level.FINEST; 12 | Logger.root.onRecord.listen((record) { 13 | io.stdout.writeln('${record.level.name} [${record.loggerName}]' 14 | '[' 15 | '${record.time.hour.toString()}:' 16 | '${record.time.minute.toString().padLeft(2, "0")}:' 17 | '${record.time.second.toString().padLeft(2, "0")}.' 18 | '${record.time.millisecond.toString().padRight(3, "0")}' 19 | '] ${record.message}'); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/flutter-mediapipe/d3e554eacc81bc469fad525f54ed533b2fc585e7/packages/mediapipe-task-text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.files.downloads.read-only 10 | 11 | com.apple.security.network.server 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | publish_to: "none" 4 | version: 0.1.0 5 | 6 | environment: 7 | sdk: ^3.4.0 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | getwidget: ^4.0.0 13 | logging: ^1.2.0 14 | mediapipe_core: ^0.0.1 15 | mediapipe_text: 16 | path: ../ 17 | path: ^1.8.3 18 | path_provider: ^2.1.1 19 | 20 | dev_dependencies: 21 | flutter_lints: ^2.0.0 22 | flutter_test: 23 | sdk: flutter 24 | 25 | flutter: 26 | uses-material-design: true 27 | 28 | assets: 29 | - assets/bert_classifier.tflite 30 | - assets/language_detector.tflite 31 | - assets/universal_sentence_encoder.tflite 32 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/ffigen.yaml: -------------------------------------------------------------------------------- 1 | name: "MediaPipeTextBindings" 2 | description: "Bindings for MediaPipe structs for text-related tasks" 3 | output: 4 | bindings: "lib/src/io/third_party/mediapipe/generated/mediapipe_text_bindings.dart" 5 | headers: 6 | entry-points: 7 | - "third_party/mediapipe/tasks/c/**.h" 8 | import: 9 | symbol-files: 10 | - "package:mediapipe_core/generated/core_symbols.yaml" 11 | preamble: | 12 | /* Copyright 2023 The MediaPipe Authors. 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | ==============================================================================*/ 23 | ffi-native: 24 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/interface/interface.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/io.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/io/mediapipe_text.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/mediapipe_text.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Package containing MediaPipe's text-specific tasks. 6 | library mediapipe_text; 7 | 8 | export 'universal_mediapipe_text.dart' 9 | if (dart.library.html) 'src/web/mediapipe_text.dart' 10 | if (dart.library.io) 'src/io/mediapipe_text.dart'; 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'tasks/tasks.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/language_detection/language_detection.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'language_detector_result.dart'; 6 | export 'language_detector_options.dart'; 7 | export 'language_detector.dart'; 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/language_detection/language_detector.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'language_detection.dart'; 6 | 7 | /// {@template LanguageDetector} 8 | /// Predicts the language of an input text. 9 | /// 10 | /// Usage: 11 | /// ```dart 12 | /// final options = LanguageDetectorOptions(); // optional parameters 13 | /// final detector = LanguageDetector(options); 14 | /// final result = await detector.detect('¿Como estas?') 15 | /// print(result.predictions.first.languageCode); 16 | /// > "es" 17 | /// detector.dispose(); 18 | /// ``` 19 | /// {@endtemplate} 20 | abstract class BaseLanguageDetector { 21 | /// {@template LanguageDetector.detect} 22 | /// Sends a [String] value to MediaPipe for language detection. 23 | /// {@endtemplate} 24 | Future detect(String text); 25 | 26 | /// Cleans up all resources. 27 | void dispose(); 28 | } 29 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/language_detection/language_detector_options.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | 7 | /// {@template TextClassifierOptions} 8 | /// Configuration object for a MediaPipe text classifier. 9 | /// 10 | /// See also: 11 | /// * [MediaPipe's TextClassifierOptions documentation](https://developers.google.com/mediapipe/api/solutions/js/tasks-text.textclassifieroptions) 12 | /// {@endtemplate} 13 | /// 14 | /// This implementation is not immutable to track whether `dispose` has been 15 | /// called. All values used by pkg:equatable are in fact immutable. 16 | // ignore: must_be_immutable 17 | abstract class BaseLanguageDetectorOptions extends BaseTaskOptions { 18 | /// Contains parameter options for how this classifier should behave, 19 | /// including allow and denylists, thresholds, maximum results, etc. 20 | /// 21 | /// See also: 22 | /// * [BaseClassifierOptions] for each available field. 23 | BaseClassifierOptions get classifierOptions; 24 | 25 | @override 26 | String toString() => 'LanguageDetectorOptions(baseOptions: $baseOptions, ' 27 | 'classifierOptions: $classifierOptions)'; 28 | 29 | @override 30 | List get props => [baseOptions, classifierOptions]; 31 | } 32 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/language_detection/language_detector_result.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | 7 | /// {@template LanguageDetectionResult} 8 | /// Container with results of MediaPipe's language detection task. 9 | /// 10 | /// See also: 11 | /// * [MediaPipe's LanguageDetectionResult documentation](https://developers.google.com/mediapipe/api/solutions/java/com/google/mediapipe/tasks/text/languagedetector/LanguageDetectorResult) 12 | /// {@endtemplate} 13 | abstract class BaseLanguageDetectorResult extends TaskResult { 14 | /// A list of predictions from the LanguageDetector. 15 | Iterable get predictions; 16 | } 17 | 18 | /// {@template LanguagePrediction} 19 | /// A language code and its probability. Used as part of the output of 20 | /// a language detector. 21 | /// {@endtemplate} 22 | abstract class BaseLanguagePrediction { 23 | /// The i18n language / locale code for the prediction. 24 | String get languageCode; 25 | 26 | /// The probability for the prediction. 27 | double get probability; 28 | } 29 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/tasks.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'language_detection/language_detection.dart'; 6 | export 'text_embedding/text_embedding.dart'; 7 | export 'text_classification/text_classification.dart'; 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_classification/text_classification.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'text_classifier.dart'; 6 | export 'text_classifier_options.dart'; 7 | export 'text_classifier_result.dart'; 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_classification/text_classifier.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'text_classification.dart'; 6 | 7 | /// {@template TextClassifier} 8 | /// Utility to analyze text via MediaPipe's text classification task. 9 | /// {@endtemplate} 10 | abstract class BaseTextClassifier { 11 | /// {@template TextClassifier.classify} 12 | /// Sends a [String] value to MediaPipe for classification. 13 | /// {@endtemplate} 14 | Future classify(String text); 15 | 16 | /// Cleans up all resources. 17 | void dispose(); 18 | } 19 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_classification/text_classifier_options.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | 7 | /// {@template TextClassifierOptions} 8 | /// Configuration object for a MediaPipe text classifier. 9 | /// 10 | /// See also: 11 | /// * [MediaPipe's TextClassifierOptions documentation](https://developers.google.com/mediapipe/api/solutions/js/tasks-text.textclassifieroptions) 12 | /// {@endtemplate} 13 | /// 14 | /// This implementation is not immutable to track whether `dispose` has been 15 | /// called. All values used by pkg:equatable are in fact immutable. 16 | // ignore: must_be_immutable 17 | abstract class BaseTextClassifierOptions extends BaseTaskOptions { 18 | /// Contains parameter options for how this classifier should behave, 19 | /// including allow and denylists, thresholds, maximum results, etc. 20 | /// 21 | /// See also: 22 | /// * [BaseClassifierOptions] for each available field. 23 | BaseClassifierOptions get classifierOptions; 24 | 25 | @override 26 | String toString() => 'TextClassifierOptions(baseOptions: $baseOptions, ' 27 | 'classifierOptions: $classifierOptions)'; 28 | 29 | @override 30 | List get props => [baseOptions, classifierOptions]; 31 | } 32 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_classification/text_classifier_result.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | 7 | /// {@template TextClassifierResult} 8 | /// Container with results of MediaPipe's `classifyText` task. 9 | /// 10 | /// See also: 11 | /// * [MediaPipe's TextClassifierResult documentation](https://developers.google.com/mediapipe/api/solutions/java/com/google/mediapipe/tasks/text/textclassifier/TextClassifierResult) 12 | /// {@endtemplate} 13 | abstract class BaseTextClassifierResult extends BaseClassifierResult { 14 | /// {@macro TextClassifierResult} 15 | BaseTextClassifierResult(); 16 | } 17 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_embedding/text_embedder.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | import 'package:mediapipe_core/mediapipe_core.dart'; 7 | 8 | /// {@template TextEmbedder} 9 | /// Utility to convert text into an embedding suitable for other MediaPipe tasks. 10 | /// {@endtemplate} 11 | abstract class BaseTextEmbedder { 12 | /// {@template TextEmbedder.embed} 13 | /// Sends a [String] value to MediaPipe for conversion into an [Embedding]. 14 | /// {@endtemplate} 15 | Future embed(String text); 16 | 17 | /// {@template TextEmbedder.cosineSimilarity} 18 | /// Compares the similarity between two [Embedding] values. Identical 19 | /// embeddings will yield a similarity value of 1.0. 20 | /// {@endtemplate} 21 | Future cosineSimilarity(Embedding a, Embedding b); 22 | 23 | /// Cleans up all resources. 24 | void dispose(); 25 | } 26 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_embedding/text_embedder_options.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:mediapipe_core/interface.dart'; 6 | 7 | /// {@template TextEmbedderOptions} 8 | /// Configuration object for a MediaPipe text embedder. 9 | /// 10 | /// See also: 11 | /// * [MediaPipe's TextEmbedderOptions documentation](https://developers.google.com/mediapipe/api/solutions/java/com/google/mediapipe/tasks/text/textembedder/TextEmbedder.TextEmbedderOptions) 12 | /// {@endtemplate} 13 | /// 14 | /// This implementation is not immutable to track whether `dispose` has been 15 | /// called. All values used by pkg:equatable are in fact immutable. 16 | // ignore: must_be_immutable 17 | abstract class BaseTextEmbedderOptions extends BaseTaskOptions { 18 | /// Contains parameter options for how this embedder should behave. 19 | BaseEmbedderOptions get embedderOptions; 20 | 21 | @override 22 | String toString() => 'TextEmbedderOptions(baseOptions: $baseOptions, ' 23 | 'embedderOptions: $embedderOptions)'; 24 | 25 | @override 26 | List get props => [baseOptions, embedderOptions]; 27 | } 28 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/interface/tasks/text_embedding/text_embedding.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'text_embedder.dart'; 6 | export 'text_embedder_options.dart'; 7 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/mediapipe_text.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'tasks/tasks.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/tasks/language_detection/language_detection.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'language_detector_result.dart'; 6 | export 'language_detector_executor.dart'; 7 | export 'language_detector_options.dart'; 8 | export 'language_detector.dart'; 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/tasks/tasks.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'language_detection/language_detection.dart'; 6 | export 'text_classification/text_classification.dart'; 7 | export 'text_embedding/text_embedding.dart'; 8 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/tasks/text_classification/text_classification.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'text_classifier.dart'; 6 | export 'text_classifier_executor.dart'; 7 | export 'text_classifier_options.dart'; 8 | export 'text_classifier_result.dart'; 9 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/tasks/text_classification/text_classifier_result.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:ffi'; 6 | 7 | import 'package:mediapipe_core/io.dart'; 8 | import 'package:mediapipe_text/interface.dart'; 9 | import '../../third_party/mediapipe/generated/mediapipe_text_bindings.dart' 10 | as bindings; 11 | 12 | /// {@macro TextClassifierResult} 13 | class TextClassifierResult extends BaseTextClassifierResult with IOTaskResult { 14 | /// {@macro TextClassifierResult.fake} 15 | TextClassifierResult({required Iterable classifications}) 16 | : _classifications = classifications, 17 | _pointer = null; 18 | 19 | /// {@template TextClassifierResult.native} 20 | /// Initializes a [TextClassifierResult] instance as a wrapper around native 21 | /// memory. 22 | /// 23 | /// See also: 24 | /// * [TextClassifierExecutor.classify] where this is called. 25 | /// {@endtemplate} 26 | TextClassifierResult.native(this._pointer); 27 | 28 | final Pointer? _pointer; 29 | 30 | Iterable? _classifications; 31 | @override 32 | Iterable get classifications => 33 | _classifications ??= _getClassifications(); 34 | Iterable _getClassifications() { 35 | if (_pointer.isNullOrNullPointer) { 36 | throw Exception( 37 | 'No native memory for TextClassifierResult.classifications', 38 | ); 39 | } 40 | return Classifications.fromNativeArray( 41 | _pointer!.ref.classifications, 42 | _pointer.ref.classifications_count, 43 | ); 44 | } 45 | 46 | @override 47 | void dispose() { 48 | assert(() { 49 | if (isClosed) { 50 | throw Exception( 51 | 'A TextClassifierResult was closed after it had already been closed. ' 52 | 'TextClassifierResult objects should only be closed when they are at' 53 | 'their end of life and will never be used again.', 54 | ); 55 | } 56 | return true; 57 | }()); 58 | if (_pointer != null) { 59 | // Only call the native finalizer if there actually is native memory, 60 | // because tests may verify that faked results are also closed and calling 61 | // this method in that scenario would cause a segfault. 62 | bindings.text_classifier_close_result(_pointer); 63 | } 64 | super.dispose(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/tasks/text_embedding/text_embedder_result.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:ffi'; 6 | import 'package:mediapipe_core/io.dart'; 7 | import 'package:mediapipe_core/interface.dart'; 8 | import '../../third_party/mediapipe/generated/mediapipe_text_bindings.dart' 9 | as bindings; 10 | 11 | /// {@macro TextEmbedderResult} 12 | class TextEmbedderResult extends BaseEmbedderResult with IOTaskResult { 13 | /// {@macro TextEmbedderResult.fake} 14 | TextEmbedderResult({required Iterable embeddings}) 15 | : _embeddings = embeddings; 16 | 17 | /// {@template TextEmbedderResult.native} 18 | /// Initializes a [TextEmbedderResult] instance as a wrapper around native 19 | /// memory. 20 | /// 21 | /// See also: 22 | /// * [TextEmbedderExecutor.embed] where this is called. 23 | /// {@endtemplate} 24 | TextEmbedderResult.native(this._pointer); 25 | 26 | Pointer? _pointer; 27 | 28 | Iterable? _embeddings; 29 | @override 30 | Iterable get embeddings => _embeddings ??= _getEmbeddings(); 31 | Iterable _getEmbeddings() { 32 | if (_pointer.isNullOrNullPointer) { 33 | throw Exception( 34 | 'No native memory for TextEmbedderResult.embeddings', 35 | ); 36 | } 37 | return Embedding.fromNativeArray( 38 | _pointer!.ref.embeddings, 39 | _pointer!.ref.embeddings_count, 40 | ); 41 | } 42 | 43 | @override 44 | void dispose() { 45 | assert(() { 46 | if (isClosed) { 47 | throw Exception( 48 | 'A TextEmbedderResult was closed after it had already been closed. ' 49 | 'TextEmbedderResult objects should only be closed when they are at' 50 | 'their end of life and will never be used again.', 51 | ); 52 | } 53 | return true; 54 | }()); 55 | if (_pointer != null) { 56 | // Only call the native finalizer if there actually is native memory, 57 | // because tests may verify that faked results are also closed and calling 58 | // this method in that scenario would cause a segfault. 59 | bindings.text_embedder_close_result(_pointer!); 60 | } 61 | super.dispose(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/io/tasks/text_embedding/text_embedding.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'package:mediapipe_core/interface.dart' show EmbeddingType; 6 | export 'text_embedder.dart'; 7 | export 'text_embedder_executor.dart'; 8 | export 'text_embedder_options.dart'; 9 | export 'text_embedder_result.dart'; 10 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/lib/src/web/mediapipe_text.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mediapipe_text 2 | description: An implementation of MediaPipe text-based Tasks. 3 | version: 0.0.1 4 | 5 | repository: https://github.com/google/flutter-mediapipe/tree/main/packages/mediapipe-task-text 6 | issue_tracker: https://github.com/google/flutter-mediapipe/issues/ 7 | 8 | platforms: 9 | android: 10 | ios: 11 | # linux: 12 | macos: 13 | # web: 14 | # windows: 15 | 16 | environment: 17 | # For now, `native-assets` is a Flutter experiment, which can only be 18 | # enabled on the `master` channel. 19 | sdk: ^3.4.0 20 | 21 | dependencies: 22 | async: ^2.11.0 23 | ffi: ^2.1.2 24 | http: ^1.1.0 25 | logging: ^1.2.0 26 | mediapipe_core: ^0.0.1 27 | native_assets_cli: ^0.6.0 28 | native_toolchain_c: ^0.4.2 29 | path: ^1.8.3 30 | 31 | dev_dependencies: 32 | ffigen: ^12.0.0 33 | flutter_lints: ^2.0.0 34 | test: ^1.21.0 35 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/sdk_downloads.dart: -------------------------------------------------------------------------------- 1 | // Generated file. Do not manually edit. 2 | // Used by the flutter toolchain (via build.dart) during compilation of any 3 | // Flutter app using this package. 4 | final Map>> sdkDownloadUrls = { 5 | 'android': { 6 | 'libtext': { 7 | 'arm64': 8 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/gcp_ubuntu_flutter/release/40/20240419-150307/android_arm64/libtext.so' 9 | } 10 | }, 11 | 'macos': { 12 | 'libtext': { 13 | 'arm64': 14 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/darwin_arm64/libtext.dylib', 15 | 'x64': 16 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/darwin_x86_64/libtext.dylib' 17 | } 18 | }, 19 | 'ios': { 20 | 'libtext': { 21 | 'arm64': 22 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/ios_arm64/libtext.dylib' 23 | } 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/test/language_detector_result_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:ffi'; 6 | import 'package:ffi/ffi.dart'; 7 | import 'package:mediapipe_core/io.dart'; 8 | import 'package:mediapipe_text/io.dart'; 9 | import 'package:mediapipe_text/src/io/third_party/mediapipe/generated/mediapipe_text_bindings.dart' 10 | as bindings; 11 | import 'package:test/test.dart'; 12 | 13 | void main() { 14 | group('LanguageDetectorResult.native should', () { 15 | test('load an empty object', () { 16 | final Pointer ptr = 17 | calloc(); 18 | // These fields are provided by the real MediaPipe implementation, but 19 | // Dart ignores them because they are meaningless in context of text tasks 20 | ptr.ref.predictions_count = 0; 21 | 22 | final result = LanguageDetectorResult.native(ptr); 23 | expect(result.predictions, isEmpty); 24 | }); 25 | 26 | test('load a hydrated object', () { 27 | final Pointer resultPtr = 28 | calloc(); 29 | 30 | final predictionsPtr = calloc(2); 31 | predictionsPtr[0].language_code = 'es'.copyToNative(); 32 | predictionsPtr[0].probability = 0.99; 33 | predictionsPtr[1].language_code = 'en'.copyToNative(); 34 | predictionsPtr[1].probability = 0.01; 35 | 36 | resultPtr.ref.predictions_count = 2; 37 | resultPtr.ref.predictions = predictionsPtr; 38 | 39 | final result = LanguageDetectorResult.native(resultPtr); 40 | expect(result.predictions, hasLength(2)); 41 | }, timeout: const Timeout(Duration(milliseconds: 10))); 42 | }); 43 | } 44 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/test/text_classifier_result_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:ffi'; 6 | import 'package:ffi/ffi.dart'; 7 | import 'package:mediapipe_core/src/io/test_utils.dart'; 8 | import 'package:mediapipe_text/io.dart'; 9 | import 'package:mediapipe_core/src/io/third_party/mediapipe/generated/mediapipe_common_bindings.dart' 10 | as core_bindings; 11 | import 'package:mediapipe_text/src/io/third_party/mediapipe/generated/mediapipe_text_bindings.dart' 12 | as bindings; 13 | import 'package:test/test.dart'; 14 | 15 | void main() { 16 | group('TextClassifierResult.native should', () { 17 | test('load an empty object', () { 18 | final Pointer ptr = 19 | calloc(); 20 | // These fields are provided by the real MediaPipe implementation, but 21 | // Dart ignores them because they are meaningless in context of text tasks 22 | ptr.ref.classifications_count = 0; 23 | ptr.ref.has_timestamp_ms = true; 24 | 25 | final result = TextClassifierResult.native(ptr); 26 | expect(result.classifications, isEmpty); 27 | }); 28 | 29 | test('load a hydrated object', () { 30 | final Pointer resultPtr = 31 | calloc(); 32 | 33 | final classificationsPtr = calloc(2); 34 | populateClassifications(classificationsPtr[0]); 35 | populateClassifications(classificationsPtr[1]); 36 | 37 | resultPtr.ref.classifications_count = 2; 38 | resultPtr.ref.classifications = classificationsPtr; 39 | resultPtr.ref.has_timestamp_ms = true; 40 | resultPtr.ref.timestamp_ms = 0; 41 | 42 | final result = TextClassifierResult.native(resultPtr); 43 | expect(result.classifications, hasLength(2)); 44 | }, timeout: const Timeout(Duration(milliseconds: 10))); 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /packages/mediapipe-task-text/test/text_embedder_result_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:ffi'; 6 | import 'package:ffi/ffi.dart'; 7 | import 'package:mediapipe_core/src/io/test_utils.dart'; 8 | import 'package:mediapipe_text/io.dart'; 9 | import 'package:mediapipe_core/src/io/third_party/mediapipe/generated/mediapipe_common_bindings.dart' 10 | as core_bindings; 11 | import 'package:mediapipe_text/src/io/third_party/mediapipe/generated/mediapipe_text_bindings.dart' 12 | as bindings; 13 | import 'package:test/test.dart'; 14 | 15 | void main() { 16 | group('TextEmbedderResult.native should', () { 17 | test('load an empty object', () { 18 | final Pointer ptr = 19 | calloc(); 20 | // These fields are provided by the real MediaPipe implementation, but 21 | // Dart ignores them because they are meaningless in context of text tasks 22 | ptr.ref.embeddings_count = 0; 23 | ptr.ref.has_timestamp_ms = false; 24 | 25 | final result = TextEmbedderResult.native(ptr); 26 | expect(result.embeddings, isEmpty); 27 | }); 28 | 29 | test('load a hydrated object', () { 30 | final Pointer resultPtr = 31 | calloc(); 32 | 33 | final embeddingsPtr = calloc(2); 34 | populateEmbedding(embeddingsPtr[0], length: 50); 35 | populateEmbedding(embeddingsPtr[1], length: 25); 36 | 37 | resultPtr.ref.embeddings_count = 2; 38 | resultPtr.ref.embeddings = embeddingsPtr; 39 | resultPtr.ref.has_timestamp_ms = false; 40 | 41 | final result = TextEmbedderResult.native(resultPtr); 42 | expect(result.embeddings, hasLength(2)); 43 | final embedding = result.embeddings.take(1).toList().first; 44 | expect(embedding.type, EmbeddingType.float); 45 | expect(embedding.length, 50); 46 | final embedding2 = result.embeddings.skip(1).take(1).toList().last; 47 | expect(embedding2.type, EmbeddingType.float); 48 | expect(embedding2.length, 25); 49 | }, timeout: const Timeout(Duration(milliseconds: 10))); 50 | }); 51 | } 52 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | build/ 30 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "7cfd3d47fc2e9a9266795e512d03ffd6f7f451fc" 8 | channel: "master" 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2023, the MediaPipe project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/README.md: -------------------------------------------------------------------------------- 1 | # mediapipe_task_vision 2 | 3 | A new Flutter plugin project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter 8 | [plug-in package](https://flutter.dev/developing-packages/), 9 | a specialized package that includes platform-specific implementation code for 10 | Android and/or iOS. 11 | 12 | For help getting started with Flutter development, view the 13 | [online documentation](https://flutter.dev/docs), which offers tutorials, 14 | samples, guidance on mobile development, and a full API reference. 15 | 16 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | 3 | analyzer: 4 | exclude: 5 | - "**/mediapipe_vision_bindings.dart" 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/ffigen.yaml: -------------------------------------------------------------------------------- 1 | name: "MediaPipeVisionBindings" 2 | description: "Bindings for MediaPipe structs for vision-related tasks" 3 | output: 4 | bindings: "lib/third_party/mediapipe/mediapipe_vision_bindings.dart" 5 | headers: 6 | entry-points: 7 | - "third_party/mediapipe/tasks/c/**" 8 | import: 9 | symbol-files: 10 | - "package:mediapipe_core/generated/core_symbols.yaml" 11 | preamble: | 12 | /* Copyright 2023 The MediaPipe Authors. 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | http://www.apache.org/licenses/LICENSE-2.0 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | ==============================================================================*/ 23 | ffi-native: 24 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/interface/interface.dart'; -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/io.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | export 'src/io/mediapipe_vision.dart'; 6 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/mediapipe_vision.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /// Package containing MediaPipe's vision-specific tasks. 6 | library mediapipe_vision; 7 | 8 | export 'universal_mediapipe_vision.dart' 9 | if (dart.library.html) 'src/web/mediapipe_vision.dart' 10 | if (dart.library.io) 'src/io/mediapipe_vision.dart'; 11 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/src/interface/interface.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/src/interface/tasks/tasks.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/src/io/mediapipe_vision.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/src/io/tasks/tasks.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/lib/universal_mediapipe_vision.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: mediapipe_vision 2 | description: "A new Flutter package project." 3 | version: 0.0.1 4 | repository: https://github.com/google/flutter-mediapipe 5 | issue_tracker: https://github.com/google/flutter-mediapipe/issues 6 | publish_to: none 7 | 8 | environment: 9 | sdk: ">=3.3.0-33.0.dev <4.0.0" 10 | flutter: ">=1.17.0" 11 | 12 | dependencies: 13 | ffi: ^2.1.0 14 | flutter: 15 | sdk: flutter 16 | logging: ^1.2.0 17 | mediapipe_core: 18 | path: ../mediapipe-core 19 | 20 | dev_dependencies: 21 | ffigen: ^9.0.1 22 | flutter_lints: ^2.0.0 23 | flutter_test: 24 | sdk: flutter 25 | 26 | # For information on the generic Dart part of this file, see the 27 | # following page: https://dart.dev/tools/pub/pubspec 28 | # The following section is specific to Flutter packages. 29 | flutter: null 30 | # To add assets to your package, add an assets section, like this: 31 | # assets: 32 | # - images/a_dot_burr.jpeg 33 | # - images/a_dot_ham.jpeg 34 | # 35 | # For details regarding assets in packages, see 36 | # https://flutter.dev/assets-and-images/#from-packages 37 | # 38 | # An image asset can refer to one or more resolution-specific "variants", see 39 | # https://flutter.dev/assets-and-images/#resolution-aware 40 | # To add custom fonts to your package, add a fonts section here, 41 | # in this "flutter" section. Each entry in this list should have a 42 | # "family" key with the font family name, and a "fonts" key with a 43 | # list giving the asset and other descriptors for the font. For 44 | # example: 45 | # fonts: 46 | # - family: Schyler 47 | # fonts: 48 | # - asset: fonts/Schyler-Regular.ttf 49 | # - asset: fonts/Schyler-Italic.ttf 50 | # style: italic 51 | # - family: Trajan Pro 52 | # fonts: 53 | # - asset: fonts/TrajanPro.ttf 54 | # - asset: fonts/TrajanPro_Bold.ttf 55 | # weight: 700 56 | # 57 | # For details regarding fonts in packages, see 58 | # https://flutter.dev/custom-fonts/#from-packages 59 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/sdk_downloads.dart: -------------------------------------------------------------------------------- 1 | // Generated file. Do not manually edit. 2 | // Used by the flutter toolchain (via build.dart) during compilation of any 3 | // Flutter app using this package. 4 | final Map>> sdkDownloadUrls = { 5 | 'android': { 6 | 'libvision': { 7 | 'arm64': 8 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/gcp_ubuntu_flutter/release/40/20240419-150307/android_arm64/libvision.so' 9 | } 10 | }, 11 | 'macos': { 12 | 'libvision': { 13 | 'arm64': 14 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/darwin_arm64/libvision.dylib', 15 | 'x64': 16 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/darwin_x86_64/libvision.dylib' 17 | } 18 | }, 19 | 'ios': { 20 | 'libvision': { 21 | 'arm64': 22 | 'https://storage.googleapis.com/mediapipe-nightly-public/prod/mediapipe/macos_flutter/release/61/20240508-094837/ios_arm64/libvision.dylib' 23 | } 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /packages/mediapipe-task-vision/test/mediapipe_vision_test.dart: -------------------------------------------------------------------------------- 1 | // import 'package:flutter_test/flutter_test.dart'; 2 | 3 | // import 'package:mediapipe_vision/mediapipe_vision.dart'; 4 | 5 | void main() {} 6 | -------------------------------------------------------------------------------- /tool/builder/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | -------------------------------------------------------------------------------- /tool/builder/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version with headers command to sync C headers from `google/mediapipe`. 4 | -------------------------------------------------------------------------------- /tool/builder/README.md: -------------------------------------------------------------------------------- 1 | # Flutter MediaPipe builder 2 | 3 | Helper utility which performs build or CI/CD step operations necessary to develop, release, and use `flutter-mediapipe`. 4 | 5 | ### Usage: 6 | 7 | Usage depends on which task you need to accomplish. All supported workflows are described below. 8 | 9 | #### Header aggregation 10 | 11 | Header files across all tasks in `google/flutter-mediapipe` have to stay in sync with their origin, `google/mediapipe`. To 12 | resync these files, check out both repositories on the same machine (ideally next to each other on the file system) and run: 13 | 14 | ```sh 15 | $ dart tool/builder/bin/main.dart headers 16 | ``` 17 | 18 | -- 19 | 20 | Check back in the future for any additional development workflows this command may support. -------------------------------------------------------------------------------- /tool/builder/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml 2 | 3 | analyzer: 4 | errors: 5 | todo: ignore 6 | 7 | linter: 8 | rules: 9 | - always_declare_return_types 10 | - avoid_dynamic_calls 11 | - comment_references 12 | - directives_ordering 13 | - library_annotations 14 | - only_throw_errors 15 | - prefer_relative_imports 16 | - prefer_single_quotes 17 | - sort_pub_dependencies 18 | -------------------------------------------------------------------------------- /tool/builder/bin/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:args/command_runner.dart'; 6 | import 'package:builder/download_model.dart'; 7 | import 'package:builder/sdks_finder.dart'; 8 | import 'package:builder/sync_headers.dart'; 9 | 10 | final runner = CommandRunner( 11 | 'build', 12 | 'Performs build operations for google/flutter-mediapipe that ' 13 | 'depend on contents in this repository.', 14 | ) 15 | ..addCommand(DownloadModelCommand()) 16 | ..addCommand(SdksFinderCommand()) 17 | ..addCommand(SyncHeadersCommand()); 18 | 19 | void main(List arguments) => runner.run(arguments); 20 | -------------------------------------------------------------------------------- /tool/builder/lib/extensions.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:convert'; 6 | import 'dart:io'; 7 | 8 | extension EasyOutput on Process { 9 | Future> get processedStdErr => _process(this.stderr); 10 | 11 | Future> get processedStdOut => _process(this.stdout); 12 | 13 | Future> _process(Stream> stream) async { 14 | return utf8.decoder 15 | .convert((await stream.toList()) 16 | .fold>([], (arr, el) => arr..addAll(el))) 17 | .split('\n'); 18 | } 19 | } 20 | 21 | /// Returns the last full chunk from a Url-like String. 22 | /// 23 | /// From "/an/awesome/url/", returns "url". 24 | /// From "/an/awesome/url", returns "url". 25 | /// From "/an/awesome/url/", with a depth of 1, returns "awesome" 26 | /// From "/an/awesome/url", with a depth of 1, returns "awesome" 27 | String lastChunk(String url, {int depth = 0, String delimiter = '/'}) { 28 | final indexOffset = (url.endsWith(delimiter)) ? -2 - depth : -1 - depth; 29 | final splitUrl = url.split(delimiter); 30 | return splitUrl[splitUrl.length + indexOffset]; 31 | } 32 | 33 | extension DefaultableMap on Map { 34 | void setDefault(K key, V def) { 35 | if (!containsKey(key)) { 36 | this[key] = def; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tool/builder/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: builder 2 | description: Performs build operations for google/flutter-mediapipe. 3 | 4 | publish_to: none 5 | 6 | environment: 7 | sdk: ^3.1.5 8 | 9 | dependencies: 10 | args: ^2.4.2 11 | http: ^1.1.0 12 | io: ^1.0.4 13 | logging: ^1.2.0 14 | native_assets_cli: ^0.3.2 15 | path: ^1.8.0 16 | process: ^5.0.0 17 | 18 | dev_dependencies: 19 | ffigen: ^9.0.1 20 | lints: ^2.1.0 21 | test: ^1.24.0 22 | -------------------------------------------------------------------------------- /tool/ci_script_shared.sh: -------------------------------------------------------------------------------- 1 | function ci_text_package() { 2 | # Download bert_classifier.tflite model into example/assets for integration tests 3 | pushd ../../tool/builder 4 | dart pub get 5 | echo "Downloading TextClassification model" 6 | dart bin/main.dart model -m textclassification 7 | echo "Downloading TextEmbedding model" 8 | dart bin/main.dart model -m textembedding 9 | echo "Downloading Language Detection model" 10 | dart bin/main.dart model -m languagedetection 11 | popd 12 | } 13 | 14 | function ci_package () { 15 | local channel="$1" 16 | 17 | shift 18 | local arr=("$@") 19 | for PACKAGE_NAME in "${arr[@]}" 20 | do 21 | echo "== Testing '${PACKAGE_NAME}' on Flutter's $channel channel ==" 22 | pushd "packages/${PACKAGE_NAME}" 23 | 24 | if [[ $PACKAGE_NAME == "mediapipe-task-text" ]]; then 25 | ci_text_package 26 | fi 27 | 28 | # Grab packages. 29 | flutter pub get 30 | 31 | # Run the analyzer to find any static analysis issues. 32 | dart analyze --fatal-infos 33 | 34 | # Run the formatter on all the dart files to make sure everything's linted. 35 | dart format --output none --set-exit-if-changed . 36 | 37 | # Turn on the native-assets feature required by flutter-mediapipe 38 | flutter config --enable-native-assets 39 | 40 | # Run the actual tests if they exist. 41 | if [ -d "test" ] 42 | then 43 | dart --enable-experiment=native-assets test 44 | fi 45 | 46 | # Run any example tests if they exist 47 | if [ -d "example/test" ] 48 | then 49 | echo "Analyzing '${PACKAGE_NAME}/example'" 50 | 51 | pushd "example" 52 | 53 | flutter pub get 54 | 55 | # Run the analyzer to find any static analysis issues. 56 | dart analyze --fatal-infos 57 | 58 | # Run the formatter on all the dart files to make sure everything's linted. 59 | dart format --output none --set-exit-if-changed . 60 | 61 | flutter test 62 | 63 | popd 64 | fi 65 | 66 | popd 67 | done 68 | } 69 | -------------------------------------------------------------------------------- /tool/mediapipe_ci_script_beta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DIR="${BASH_SOURCE%/*}" 6 | source "$DIR/ci_script_shared.sh" 7 | 8 | flutter doctor -v 9 | 10 | declare -ar PACKAGE_NAMES=( 11 | "mediapipe-core" 12 | "mediapipe-task-text" 13 | ) 14 | 15 | ci_package "beta" "${PACKAGE_NAMES[@]}" 16 | 17 | echo "-- Success --" 18 | -------------------------------------------------------------------------------- /tool/mediapipe_ci_script_master.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DIR="${BASH_SOURCE%/*}" 6 | source "$DIR/ci_script_shared.sh" 7 | 8 | flutter doctor -v 9 | 10 | declare -ar PACKAGE_NAMES=( 11 | "mediapipe-core" 12 | "mediapipe-task-text" 13 | ) 14 | 15 | ci_package "master" "${PACKAGE_NAMES[@]}" 16 | 17 | echo "-- Success --" 18 | -------------------------------------------------------------------------------- /tool/mediapipe_ci_script_stable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DIR="${BASH_SOURCE%/*}" 6 | source "$DIR/ci_script_shared.sh" 7 | 8 | flutter doctor -v 9 | 10 | declare -ar PACKAGE_NAMES=( 11 | "mediapipe-core" 12 | "mediapipe-task-text" 13 | ) 14 | 15 | ci_package "stable" "${PACKAGE_NAMES[@]}" 16 | 17 | echo "-- Success --" 18 | --------------------------------------------------------------------------------