├── .clang-format ├── .coveragerc ├── .flake8 ├── .gitattributes ├── .gitignore ├── .isort.cfg ├── .markdownlint.jsonc ├── .pre-commit-config.yaml ├── .pre-commit-license-header.txt ├── .shellcheckrc ├── LICENSE ├── README.md ├── apps ├── android │ ├── ChatApp │ │ ├── README.md │ │ ├── assets │ │ │ ├── ai-hub-qnn-version.png │ │ │ ├── chatapp_demo_1.mov │ │ │ └── chatapp_demo_2.mov │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ ├── README.txt │ │ │ ├── htp_config │ │ │ │ ├── qualcomm-snapdragon-8-elite.json │ │ │ │ ├── qualcomm-snapdragon-8-gen2.json │ │ │ │ └── qualcomm-snapdragon-8-gen3.json │ │ │ └── models │ │ │ │ └── llama3_2_3b │ │ │ │ └── genie_config.json │ │ │ ├── cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── GenieLib.cpp │ │ │ ├── GenieWrapper.cpp │ │ │ ├── GenieWrapper.hpp │ │ │ ├── PromptHandler.cpp │ │ │ └── PromptHandler.hpp │ │ │ ├── ic_launcher-playstore.png │ │ │ ├── java │ │ │ └── com │ │ │ │ └── quicinc │ │ │ │ └── chatapp │ │ │ │ ├── ChatMessage.java │ │ │ │ ├── Conversation.java │ │ │ │ ├── GenieWrapper.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MessageSender.java │ │ │ │ ├── Message_RecyclerViewAdapter.java │ │ │ │ └── StringCallback.java │ │ │ └── res │ │ │ ├── drawable │ │ │ ├── bot_response.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── ic_launcher_foreground.xml │ │ │ ├── text_rounded_corner.xml │ │ │ └── user_input.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── chat.xml │ │ │ └── chat_row.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.webp │ │ │ ├── ic_launcher_foreground.webp │ │ │ └── ic_launcher_round.webp │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── themes.xml │ │ │ └── xml │ │ │ ├── backup_rules.xml │ │ │ └── data_extraction_rules.xml │ ├── ImageClassification │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ ├── README.txt │ │ │ ├── images │ │ │ │ ├── Sample1.png │ │ │ │ ├── Sample2.png │ │ │ │ └── Sample3.png │ │ │ └── labels.txt │ │ │ ├── java │ │ │ └── com │ │ │ │ └── quicinc │ │ │ │ ├── ImageProcessing.java │ │ │ │ ├── imageclassification │ │ │ │ ├── ImageClassification.java │ │ │ │ └── MainActivity.java │ │ │ │ └── tflite │ │ │ │ ├── AIHubDefaults.java │ │ │ │ └── TFLiteHelpers.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ ├── ic_launcher_background.xml │ │ │ └── image_classification_icon.png │ │ │ ├── layout │ │ │ └── main_activity.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── themes.xml │ ├── SemanticSegmentation │ │ ├── .gitattributes │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── README.txt │ │ │ ├── ic_launcher-playstore.png │ │ │ ├── java │ │ │ └── com │ │ │ │ └── quicinc │ │ │ │ ├── semanticsegmentation │ │ │ │ ├── CameraFragment.java │ │ │ │ ├── FragmentRender.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── SemanticSegmentation.java │ │ │ │ └── tflite │ │ │ │ ├── AIHubDefaults.java │ │ │ │ └── TFLiteHelpers.java │ │ │ └── res │ │ │ ├── layout │ │ │ ├── fragment_camera.xml │ │ │ └── main_activity.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_background.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_background.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_background.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_background.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_background.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimen.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── SuperResolution │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ ├── README.txt │ │ │ └── images │ │ │ │ ├── Sample1.jpg │ │ │ │ └── Sample2.jpg │ │ │ ├── java │ │ │ └── com │ │ │ │ └── quicinc │ │ │ │ ├── ImageProcessing.java │ │ │ │ ├── superresolution │ │ │ │ ├── MainActivity.java │ │ │ │ └── SuperResolution.java │ │ │ │ └── tflite │ │ │ │ ├── AIHubDefaults.java │ │ │ │ └── TFLiteHelpers.java │ │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ ├── ic_launcher_background.xml │ │ │ └── super_resolution_icon.png │ │ │ ├── layout │ │ │ └── main_activity.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── themes.xml │ ├── WhisperKit │ │ └── README.md │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── image_preprocessing_helpers │ │ └── ImageProcessing.java │ ├── settings.gradle │ └── tflite_helpers │ │ ├── AIHubDefaults.java │ │ └── TFLiteHelpers.java └── windows │ ├── cpp │ ├── ChatApp │ │ ├── .gitignore │ │ ├── ChatApp.cpp │ │ ├── ChatApp.hpp │ │ ├── ChatApp.sln │ │ ├── ChatApp.vcxproj │ │ ├── ChatApp.vcxproj.filters │ │ ├── ChatApp.vcxproj.user │ │ ├── Main.cpp │ │ ├── PromptHandler.cpp │ │ ├── PromptHandler.hpp │ │ ├── README.md │ │ └── assets │ │ │ └── images │ │ │ ├── ai-hub-qnn-version.png │ │ │ ├── sample-qnn-sdk-check.png │ │ │ └── sample_output.png │ ├── Classification │ │ ├── Classification.sln │ │ ├── Classification.vcxproj │ │ ├── Classification.vcxproj.filters │ │ ├── Classification.vcxproj.user │ │ ├── ClassificationApp.cpp │ │ ├── ClassificationApp.hpp │ │ ├── Main.cpp │ │ ├── README.md │ │ ├── Utilities.cpp │ │ ├── Utilities.hpp │ │ ├── assets │ │ │ ├── images │ │ │ │ ├── classificationOutput.png │ │ │ │ └── keyboard.jpg │ │ │ └── models │ │ │ │ └── README.md │ │ ├── packages.config │ │ ├── synset.txt │ │ ├── vcpkg-configuration.json │ │ └── vcpkg.json │ ├── ObjectDetection │ │ ├── Main.cpp │ │ ├── ObjectDetection.sln │ │ ├── ObjectDetection.vcxproj │ │ ├── ObjectDetection.vcxproj.filters │ │ ├── ObjectDetection.vcxproj.user │ │ ├── ObjectDetectionApp.cpp │ │ ├── ObjectDetectionApp.hpp │ │ ├── README.md │ │ ├── Utilities.cpp │ │ ├── Utilities.hpp │ │ ├── assets │ │ │ ├── images │ │ │ │ ├── keyboard.jpg │ │ │ │ ├── kitchen.jpg │ │ │ │ └── sample_outputs │ │ │ │ │ └── kitchen_output.jpg │ │ │ └── models │ │ │ │ └── README.md │ │ ├── packages.config │ │ ├── vcpkg-configuration.json │ │ └── vcpkg.json │ └── SuperResolution │ │ ├── Main.cpp │ │ ├── README.md │ │ ├── SuperResolution.sln │ │ ├── SuperResolution.vcxproj │ │ ├── SuperResolution.vcxproj.filters │ │ ├── SuperResolution.vcxproj.user │ │ ├── SuperResolutionApp.cpp │ │ ├── SuperResolutionApp.hpp │ │ ├── Utilities.cpp │ │ ├── Utilities.hpp │ │ ├── assets │ │ ├── images │ │ │ ├── Doll.jpg │ │ │ └── UpscaledImage.png │ │ └── models │ │ │ └── README.md │ │ ├── packages.config │ │ ├── vcpkg-configuration.json │ │ └── vcpkg.json │ └── python │ ├── BringYourOwnModel │ └── README.md │ ├── StableDiffusion │ ├── README.md │ └── demo.py │ ├── Whisper │ ├── README.md │ └── demo.py │ ├── activate_venv.ps1 │ ├── install_platform_deps.ps1 │ └── install_python_deps.ps1 ├── mypy.ini ├── tutorials ├── deploy │ └── onnx │ │ ├── README.md │ │ ├── build_deployable_asset.py │ │ └── requirements.txt └── llm_on_genie │ ├── README.md │ ├── configs │ ├── genie │ │ ├── baichuan2_7b.json │ │ ├── ibm_granite_v3_1_8b_instruct.json │ │ ├── llama_v2_7b_chat.json │ │ ├── llama_v3_1_8b_instruct.json │ │ ├── llama_v3_2_3b_instruct.json │ │ ├── llama_v3_8b_instruct.json │ │ ├── llama_v3_taide_8b_chat.json │ │ ├── mistral_7b_instruct_v0_3.json │ │ ├── phi_3_5_mini_instruct.json │ │ └── qwen2_7b_instruct.json │ └── htp │ │ └── htp_backend_ext_config.json.template │ └── powershell │ ├── LlmUtils.ps1 │ ├── README.md │ └── RunLlm.ps1 └── version_info.py /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Json 3 | BasedOnStyle: llvm 4 | DisableFormat: true 5 | --- 6 | Language: Cpp 7 | BasedOnStyle: LLVM 8 | AllowAllParametersOfDeclarationOnNextLine: false 9 | AllowShortIfStatementsOnASingleLine: false 10 | AllowShortBlocksOnASingleLine: false 11 | AllowShortFunctionsOnASingleLine: false 12 | AllowShortLoopsOnASingleLine: false 13 | AlwaysBreakBeforeMultilineStrings: false 14 | BinPackParameters: false 15 | BreakBeforeBraces: Allman 16 | BreakConstructorInitializers: BeforeComma 17 | ColumnLimit: 120 18 | IndentCaseLabels: false 19 | IndentWidth: 4 20 | PointerAlignment: Left 21 | Standard: c++17 22 | --- 23 | Language: Proto 24 | DisableFormat: true 25 | --- 26 | Language: Java 27 | DisableFormat: true 28 | ... 29 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | omit = */test_*,*/test,*/test/*,build/*,src/customer/*,/private/*,/tmp/* 3 | 4 | [report] 5 | ignore_errors = True 6 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E501,W503,E203,E266,E265,F811 3 | # E501 line too long 4 | # W503 clang-formatter can produce line break before binary operator 5 | # E203 False positive "whitespaces before :" especially when slicing list, arrays etc. 6 | # E266 Too many leading '#' for block comment 7 | # E265 Block comment should start with '# ' 8 | # F811 A module has been imported twice, but seen when importing functions for fixtures in pytest files. 9 | exclude = **/*_pb2.py 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.jpg filter=lfs diff=lfs merge=lfs -text 2 | *.png filter=lfs diff=lfs merge=lfs -text 3 | *.jar filter=lfs diff=lfs merge=lfs -text 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # Distribution / packaging 7 | .Python 8 | /bench/ 9 | build/ 10 | dist/ 11 | demo_artifacts/ 12 | develop-eggs/ 13 | downloads/ 14 | eggs/ 15 | .eggs/ 16 | parts/ 17 | sdist/ 18 | var/ 19 | wheels/ 20 | pip-wheel-metadata/ 21 | share/python-wheels/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | MANIFEST 26 | **/.idea 27 | **/local.properties 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | **/.gradle 35 | **/gradle 36 | **/gradlew* 37 | 38 | # Installer logs 39 | pip-log.txt 40 | pip-delete-this-directory.txt 41 | 42 | # Unit test / coverage reports 43 | htmlcov/ 44 | .tox/ 45 | .nox/ 46 | .coverage 47 | .coverage.* 48 | .cache 49 | nosetests.xml 50 | coverage.xml 51 | *.cover 52 | *.py,cover 53 | .hypothesis/ 54 | .pytest_cache/ 55 | 56 | # Translations 57 | *.mo 58 | *.pot 59 | 60 | # PyBuilder 61 | target/ 62 | 63 | # Jupyter Notebook 64 | .ipynb_checkpoints 65 | 66 | # IPython 67 | profile_default/ 68 | ipython_config.py 69 | 70 | # pyenv 71 | .python-version 72 | qaiha-dev 73 | 74 | # pipenv 75 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 76 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 77 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 78 | # install all needed dependencies. 79 | #Pipfile.lock 80 | 81 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 82 | __pypackages__/ 83 | 84 | # Environments 85 | .venv 86 | env/ 87 | envs/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # JetBrains things 94 | .idea/ 95 | 96 | # mypy 97 | .mypy_cache/ 98 | .dmypy.json 99 | dmypy.json 100 | 101 | # Pyre type checker 102 | .pyre/ 103 | 104 | *build/* 105 | *.bin 106 | *.cxx/ 107 | *.onnx 108 | *.mlmodelc* 109 | *.pt 110 | *.wav 111 | *.npy 112 | *.csv 113 | *.dylib 114 | *.fpie 115 | *bin/ADSP_Inference_Test 116 | *.DS_Store 117 | 118 | # Hub exports 119 | **/*.mlmodel 120 | **/*.tflite 121 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile=black 3 | -------------------------------------------------------------------------------- /.markdownlint.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "MD013": false, // No line length limit 3 | "MD033": false // Allow inline HTML 4 | } 5 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # exclude: 2 | # * third_party folders 3 | # * CloudFormation templates don't pass the yaml-check hook (a known issue) 4 | 5 | exclude: | 6 | (?x)( 7 | /build/ 8 | ) 9 | 10 | repos: 11 | - repo: https://github.com/Lucas-C/pre-commit-hooks 12 | rev: v1.5.5 13 | hooks: 14 | - id: insert-license 15 | files: \.py|\.sh$ 16 | args: 17 | - --license-filepath 18 | - .pre-commit-license-header.txt 19 | - --allow-past-years 20 | - --no-extra-eol 21 | - id: insert-license 22 | files: \.java$ 23 | args: 24 | - --license-filepath 25 | - .pre-commit-license-header.txt 26 | - --comment-style 27 | - // 28 | - --allow-past-years 29 | - --no-extra-eol 30 | 31 | - repo: https://github.com/pre-commit/pre-commit-hooks 32 | rev: v4.1.0 33 | hooks: 34 | - id: check-yaml 35 | args: [--allow-multiple-documents] 36 | - id: trailing-whitespace 37 | exclude: '\.diff$' 38 | - id: check-added-large-files 39 | args: ['--maxkb=1024'] 40 | - id: check-merge-conflict 41 | - id: detect-aws-credentials 42 | args: [--allow-missing-credentials] 43 | - id: end-of-file-fixer 44 | exclude: | 45 | (?x)( 46 | \.diff$ 47 | ) 48 | - id: fix-byte-order-marker 49 | - repo: https://github.com/rhysd/actionlint 50 | rev: v1.6.26 51 | hooks: 52 | - id: actionlint 53 | - repo: https://github.com/shellcheck-py/shellcheck-py 54 | rev: v0.9.0.6 55 | hooks: 56 | - id: shellcheck 57 | exclude: gradlew 58 | - repo: https://github.com/pycqa/isort 59 | rev: 5.12.0 60 | hooks: 61 | - id: isort 62 | args: ["--filter-files"] 63 | - repo: https://github.com/psf/black 64 | rev: 22.1.0 65 | hooks: 66 | - id: black 67 | additional_dependencies: ['click==8.0.4'] 68 | - repo: https://github.com/pre-commit/mirrors-clang-format 69 | rev: v13.0.1 70 | hooks: 71 | - id: clang-format 72 | types_or: [c++, c, c#, cuda, objective-c, proto] 73 | - repo: https://github.com/pycqa/flake8 74 | rev: 6.1.0 75 | hooks: 76 | - id: flake8 77 | - repo: local 78 | hooks: 79 | - id: mypy 80 | name: mypy 81 | files: \.(py|pyi|ipynb|proto|fbs)$ 82 | entry: scripts/util/run_mypy.sh 83 | language: system 84 | -------------------------------------------------------------------------------- /.pre-commit-license-header.txt: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------- 2 | Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | SPDX-License-Identifier: BSD-3-Clause 4 | --------------------------------------------------------------------- 5 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | ## How to update these rules 2 | ## 3 | ## From repo root, `pre-commit run -a shellcheck` to run shellcheck across all files in the repo. By default, the commit hook 4 | ## will only run on your patch. However, CI runs it across all files, so if you're going to touch this file, I 5 | ## recommend forcing it to run. 6 | ## 7 | ## To run on and fix a specific file, run: 8 | ## shellcheck -x -f diff {filename} | apply 9 | ## 10 | 11 | external-sources=true 12 | 13 | ## Issue 7533: [shellcheck] Explore miscellaneous checks 14 | disable=SC2003 # expr is antiquated. Consider rewriting this using `$((..))`, `${}` or `[[ ]]`. 15 | disable=SC2005 # Useless `echo`? Instead of `echo $(cmd)`, just use `cmd` 16 | disable=SC2012 # Use `find` instead of `ls` to better handle non-alphanumeric filenames. 17 | disable=SC2116 # Useless echo? Instead of `cmd $(echo foo)`, just use `cmd foo`. 18 | disable=SC2155 # Declare and assign separately to avoid masking return values. 19 | disable=SC2166 # Prefer `[ p ] && [ q ]` as `[ p -a q ]` is not well defined. 20 | 21 | 22 | ## things we probably don't care about ever fixing. 23 | 24 | disable=SC1083 # This `{`/`}` is literal. Check if `;` is missing or quote the expression. 25 | 26 | disable=SC2001 # See if you can use `${variable//search/replace}` instead. 27 | disable=SC2064 # Use single quotes, otherwise this expands now rather than when signalled. 28 | disable=SC2129 # Consider using `{ cmd1; cmd2; } >> file` instead of individual redirects. 29 | disable=SC2143 # Use `grep -q` instead of comparing output with `[ -n .. ]`. 30 | disable=SC2148 # Tips depend on target shell and yours is unknown. Add a shebang. 31 | disable=SC2162 # `read` without `-r` will mangle backslashes. 32 | disable=SC2164 # Use `cd ... || exit` in case `cd` fails. 33 | disable=SC2181 # Check exit code directly with e.g. `if mycmd;`, not indirectly with `$?`. 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2024 Qualcomm Innovation Center, Inc. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /apps/android/ChatApp/assets/ai-hub-qnn-version.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:46380cfb7f50a5b5db155fa6b8188c4ebd766234920fb9705738b0d9eb6ae3bd 3 | size 216680 4 | -------------------------------------------------------------------------------- /apps/android/ChatApp/assets/chatapp_demo_1.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quic/ai-hub-apps/f9b38777e2071bf9c46197015b63c976fe5ab4c2/apps/android/ChatApp/assets/chatapp_demo_1.mov -------------------------------------------------------------------------------- /apps/android/ChatApp/assets/chatapp_demo_2.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quic/ai-hub-apps/f9b38777e2071bf9c46197015b63c976fe5ab4c2/apps/android/ChatApp/assets/chatapp_demo_2.mov -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 31 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/assets/README.txt: -------------------------------------------------------------------------------- 1 | Place QNN context binaries and tokenizer here 2 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/assets/htp_config/qualcomm-snapdragon-8-elite.json: -------------------------------------------------------------------------------- 1 | { 2 | "devices": [ 3 | { 4 | "soc_model": 69, 5 | "dsp_arch": "v79", 6 | "cores": [ 7 | { 8 | "core_id": 0, 9 | "perf_profile": "burst", 10 | "rpc_control_latency": 100 11 | } 12 | ] 13 | } 14 | ], 15 | "memory": { 16 | "mem_type": "shared_buffer" 17 | }, 18 | "groupContext": { 19 | "share_resources": true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/assets/htp_config/qualcomm-snapdragon-8-gen2.json: -------------------------------------------------------------------------------- 1 | { 2 | "devices": [ 3 | { 4 | "soc_model": 43, 5 | "dsp_arch": "v73", 6 | "cores": [ 7 | { 8 | "core_id": 0, 9 | "perf_profile": "burst", 10 | "rpc_control_latency": 100 11 | } 12 | ] 13 | } 14 | ], 15 | "memory": { 16 | "mem_type": "shared_buffer" 17 | }, 18 | "groupContext": { 19 | "share_resources": true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/assets/htp_config/qualcomm-snapdragon-8-gen3.json: -------------------------------------------------------------------------------- 1 | { 2 | "devices": [ 3 | { 4 | "soc_model": 57, 5 | "dsp_arch": "v75", 6 | "cores": [ 7 | { 8 | "core_id": 0, 9 | "perf_profile": "burst", 10 | "rpc_control_latency": 100 11 | } 12 | ] 13 | } 14 | ], 15 | "memory": { 16 | "mem_type": "shared_buffer" 17 | }, 18 | "groupContext": { 19 | "share_resources": true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/assets/models/llama3_2_3b/genie_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "dialog": { 3 | "version": 1, 4 | "type": "basic", 5 | "context": { 6 | "version": 1, 7 | "size": 2048, 8 | "n-vocab": 128256, 9 | "bos-token": -1, 10 | "eos-token": [128001, 128009, 128008] 11 | }, 12 | "sampler": { 13 | "version": 1, 14 | "seed": 42, 15 | "temp": 0.8, 16 | "top-k": 40, 17 | "top-p": 0.95 18 | }, 19 | "tokenizer": { 20 | "version": 1, 21 | "path": "" 22 | }, 23 | "engine": { 24 | "version": 1, 25 | "n-threads": 3, 26 | "backend": { 27 | "version": 1, 28 | "type": "QnnHtp", 29 | "QnnHtp": { 30 | "version": 1, 31 | "use-mmap": true, 32 | "spill-fill-bufsize": 0, 33 | "mmap-budget": 0, 34 | "poll": true, 35 | "cpu-mask": "0xe0", 36 | "kv-dim": 128, 37 | "allow-async-init": false 38 | }, 39 | "extensions": "" 40 | }, 41 | "model": { 42 | "version": 1, 43 | "type": "binary", 44 | "binary": { 45 | "version": 1, 46 | "ctx-bins": [ 47 | "/llama_v3_2_3b_instruct_part_1_of_3.bin", 48 | "/llama_v3_2_3b_instruct_part_2_of_3.bin", 49 | "/llama_v3_2_3b_instruct_part_3_of_3.bin" 50 | ] 51 | }, 52 | "positional-encoding": { 53 | "type": "rope", 54 | "rope-dim": 64, 55 | "rope-theta": 500000, 56 | "rope-scaling": { 57 | "rope-type": "llama3", 58 | "factor": 8.0, 59 | "low-freq-factor": 1.0, 60 | "high-freq-factor": 4.0, 61 | "original-max-position-embeddings": 8192 62 | } 63 | } 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html. 3 | # For more examples on how to use CMake, see https://github.com/android/ndk-samples. 4 | 5 | # Sets the minimum CMake version required for this project. 6 | cmake_minimum_required(VERSION 3.22.1) 7 | 8 | # Declares the project name. The project name can be accessed via ${ PROJECT_NAME}, 9 | # Since this is the top level CMakeLists.txt, the project name is also accessible 10 | # with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level 11 | # build script scope). 12 | project("chatapp") 13 | 14 | set(GENIE_HEADERS_PATH "${QNN_SDK_ROOT_PATH}/include/Genie") 15 | set(GENIE_LIB_PATH "${QNN_SDK_ROOT_PATH}/lib/aarch64-android/libGenie.so") 16 | 17 | include_directories("includes") 18 | 19 | # Include Genie headers here 20 | include_directories(${GENIE_HEADERS_PATH}) 21 | 22 | add_library(${CMAKE_PROJECT_NAME} SHARED 23 | # List C/C++ source files with relative paths to this CMakeLists.txt. 24 | PromptHandler.cpp 25 | GenieWrapper.cpp 26 | GenieLib.cpp) 27 | 28 | # Link libGenie.so here 29 | target_link_libraries(${CMAKE_PROJECT_NAME} 30 | "${GENIE_LIB_PATH}" 31 | android 32 | log) 33 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/cpp/GenieLib.cpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "GenieWrapper.hpp" 11 | 12 | extern "C" JNIEXPORT jlong JNICALL Java_com_quicinc_chatapp_GenieWrapper_loadModel(JNIEnv* env, 13 | jobject /* this */, 14 | jstring model_dir_path, 15 | jstring htp_config_path) 16 | { 17 | 18 | try 19 | { 20 | std::string model_dir = std::string(env->GetStringUTFChars(model_dir_path, 0)); 21 | std::string htp_config = std::string(env->GetStringUTFChars(htp_config_path, 0)); 22 | std::filesystem::path model_config_path = std::filesystem::path(model_dir) / "genie_config.json"; 23 | std::filesystem::path tokenizer_path = std::filesystem::path(model_dir) / "tokenizer.json"; 24 | 25 | App::GenieWrapper* chatApp = 26 | new App::GenieWrapper(model_config_path.string(), model_dir, htp_config, tokenizer_path.string()); 27 | return reinterpret_cast(chatApp); 28 | } 29 | catch (std::exception& e) 30 | { 31 | jclass exception_cls = env->FindClass("java/lang/RuntimeException"); 32 | env->ThrowNew(exception_cls, e.what()); 33 | } 34 | } 35 | 36 | extern "C" JNIEXPORT void JNICALL Java_com_quicinc_chatapp_GenieWrapper_getResponseForPrompt(JNIEnv* env, 37 | jobject /* this */, 38 | jlong genie_wrapper_handle, 39 | jstring user_question, 40 | jobject callback) 41 | { 42 | try 43 | { 44 | // Get callback method 45 | jclass callbackClass = env->GetObjectClass(callback); 46 | jmethodID onNewStringMethod = env->GetMethodID(callbackClass, "onNewString", "(Ljava/lang/String;)V"); 47 | 48 | std::string user_input = env->GetStringUTFChars(user_question, 0); 49 | 50 | // Get response from Genie 51 | App::GenieWrapper* myClass = reinterpret_cast(genie_wrapper_handle); 52 | auto response = myClass->GetResponseForPrompt(user_input, env, callback, onNewStringMethod); 53 | } 54 | catch (std::exception& e) 55 | { 56 | jclass exception_cls = env->FindClass("java/lang/RuntimeException"); 57 | env->ThrowNew(exception_cls, e.what()); 58 | } 59 | } 60 | 61 | extern "C" JNIEXPORT void JNICALL Java_com_quicinc_chatapp_GenieWrapper_freeModel(JNIEnv* env, 62 | jobject /* this */, 63 | jlong genie_wrapper_handle) 64 | { 65 | try 66 | { 67 | App::GenieWrapper* genie_wrapper = reinterpret_cast(genie_wrapper_handle); 68 | delete genie_wrapper; 69 | } 70 | catch (std::exception& e) 71 | { 72 | jclass exception_cls = env->FindClass("java/lang/RuntimeException"); 73 | env->ThrowNew(exception_cls, e.what()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/cpp/GenieWrapper.hpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include "GenieCommon.h" 11 | #include "GenieDialog.h" 12 | #include "PromptHandler.hpp" 13 | 14 | namespace App 15 | { 16 | constexpr const char* c_exit_prompt = "exit"; 17 | constexpr const char* c_bot_name = "Qbot"; 18 | 19 | class GenieWrapper 20 | { 21 | private: 22 | GenieDialogConfig_Handle_t m_config_handle = nullptr; 23 | GenieDialog_Handle_t m_dialog_handle = nullptr; 24 | std::string m_user_name; 25 | AppUtils::PromptHandler prompt_handler; 26 | 27 | public: 28 | /** 29 | * GenieWrapper: Initializes GenieWrapper 30 | * - Loads Model config with provided model path, htp config and tokenizer 31 | * - Creates handle for Genie 32 | * 33 | * @param model_config_path: local path to model Genie config file 34 | * @param models_path: local path to directory that contains model context binaries (e.g., downloaded from AI Hub) 35 | * @param htp_config_path: local path to backend htp configuration 36 | * @param tokenizer_path: local path to tokenizer to use 37 | * 38 | * @thows on failure to create handle for Genie config, dialog 39 | * 40 | */ 41 | GenieWrapper(const std::string& model_config_path, 42 | const std::string& models_path, 43 | const std::string& htp_config_path, 44 | const std::string& tokenizer_path); 45 | GenieWrapper() = delete; 46 | GenieWrapper(const GenieWrapper&) = delete; 47 | GenieWrapper(GenieWrapper&&) = delete; 48 | GenieWrapper& operator=(const GenieWrapper&) = delete; 49 | GenieWrapper& operator=(GenieWrapper&&) = delete; 50 | ~GenieWrapper(); 51 | 52 | /** 53 | * GetResponseForPrompt: Gets response from Genie for provided user prompt and callback 54 | * 55 | * @param user_prompt: User prompt provided by user 56 | * @param env: JNIEnv required to create intermediate output to pass via callback 57 | * @param callback: callback object 58 | * @param onNewStringMethod callback method to tunnel intermediate output string 59 | * 60 | * @throws on failure to query model response during chat 61 | * 62 | */ 63 | std::string 64 | GetResponseForPrompt(const std::string& user_prompt, JNIEnv* env, jobject callback, jmethodID onNewStringMethod); 65 | }; 66 | } // namespace App 67 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/cpp/PromptHandler.cpp: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | #include "PromptHandler.hpp" 6 | #include "GenieWrapper.hpp" 7 | 8 | using namespace AppUtils; 9 | 10 | // Llama3 prompt 11 | constexpr const std::string_view c_bot_name = "QBot"; 12 | constexpr const std::string_view c_first_prompt_prefix_part_1 = 13 | "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYour name is "; 14 | constexpr const std::string_view c_first_prompt_prefix_part_2 = 15 | "and you are a helpful AI assistant. Please keep answers concise and to the point. <|eot_id|>"; 16 | constexpr const std::string_view c_prompt_prefix = "<|start_header_id|>user<|end_header_id|>\n\n"; 17 | constexpr const std::string_view c_end_of_prompt = "<|eot_id|>"; 18 | constexpr const std::string_view c_assistant_header = "<|start_header_id|>assistant<|end_header_id|>\n\n"; 19 | 20 | PromptHandler::PromptHandler() 21 | : m_is_first_prompt(true) 22 | { 23 | } 24 | 25 | std::string PromptHandler::GetPromptWithTag(const std::string& user_prompt) 26 | { 27 | // Ref: https://www.llama.com/docs/model-cards-and-prompt-formats/meta-llama-3/ 28 | if (m_is_first_prompt) 29 | { 30 | m_is_first_prompt = false; 31 | return std::string(c_first_prompt_prefix_part_1) + c_bot_name.data() + c_first_prompt_prefix_part_2.data() + 32 | c_prompt_prefix.data() + user_prompt + c_end_of_prompt.data() + c_assistant_header.data(); 33 | } 34 | return std::string(c_prompt_prefix) + user_prompt.data() + c_end_of_prompt.data() + c_assistant_header.data(); 35 | } 36 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/cpp/PromptHandler.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Bhushan Sonawane on 10/6/24. 3 | // 4 | 5 | // --------------------------------------------------------------------- 6 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 7 | // SPDX-License-Identifier: BSD-3-Clause 8 | // --------------------------------------------------------------------- 9 | #pragma once 10 | 11 | #include 12 | 13 | namespace AppUtils 14 | { 15 | 16 | class PromptHandler 17 | { 18 | private: 19 | bool m_is_first_prompt; 20 | 21 | public: 22 | PromptHandler(); 23 | std::string GetPromptWithTag(const std::string& user_prompt); 24 | }; 25 | 26 | } // namespace AppUtils 27 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:0cb9369989424268b34ffc02bc948695bd6837e43869ee56e3ba3665b4220712 3 | size 41705 4 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/java/com/quicinc/chatapp/ChatMessage.java: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | package com.quicinc.chatapp; 6 | 7 | /** 8 | * ChatMessage: Holds information about each message within Chat 9 | */ 10 | public class ChatMessage { 11 | 12 | public String mMessage; 13 | public int mLength; 14 | public MessageSender mSender; 15 | 16 | public ChatMessage(String msg, MessageSender sender) { 17 | mMessage = msg; 18 | mLength = msg.length(); 19 | mSender = sender; 20 | } 21 | 22 | public boolean isMessageFromUser() { 23 | return mSender == MessageSender.USER; 24 | } 25 | 26 | public String getMessage() { 27 | return mMessage; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/java/com/quicinc/chatapp/GenieWrapper.java: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | package com.quicinc.chatapp; 6 | 7 | /** 8 | * GenieWrapper: Class to connect JNI GenieWrapper and Java code 9 | */ 10 | public class GenieWrapper { 11 | long genieWrapperNativeHandle; 12 | 13 | /** 14 | * GenieWrapper: Loads model at provided path with provided htp config 15 | * 16 | * @param modelDirPath directory path on system pointing to model bundle 17 | * @param htpConfigPath HTP config file to use 18 | */ 19 | GenieWrapper(String modelDirPath, String htpConfigPath) { 20 | genieWrapperNativeHandle = loadModel(modelDirPath, htpConfigPath); 21 | } 22 | 23 | /** 24 | * getResponseForPrompt: Generates response for provided user input 25 | * 26 | * @param userInput user input to generate response for 27 | * @param callback callback to tunnel each generated token to 28 | */ 29 | public void getResponseForPrompt(String userInput, StringCallback callback) { 30 | getResponseForPrompt(genieWrapperNativeHandle, userInput, callback); 31 | } 32 | 33 | /** 34 | * finalize: Free previously loaded model 35 | */ 36 | @Override 37 | protected void finalize() { 38 | freeModel(genieWrapperNativeHandle); 39 | } 40 | 41 | /** 42 | * loadModel: JNI method to load model using Genie C++ APIs 43 | * 44 | * @param modelDirPath directory path on system pointing to model bundle 45 | * @param htpConfigPath HTP config file to use 46 | * @return pointer to Genie C++ Wrapper to generate future responses 47 | */ 48 | private native long loadModel(String modelDirPath, String htpConfigPath); 49 | 50 | /** 51 | * getResponseForPrompt: JNI method to generate response for provided user input 52 | * 53 | * @param nativeHandle native handle captured before with LoadModel 54 | * @param userInput user input to generate response for 55 | * @param callback callback to tunnel each generated token to 56 | */ 57 | private native void getResponseForPrompt(long nativeHandle, String userInput, StringCallback callback); 58 | 59 | /** 60 | * FreeModel: JNI method to free previously loaded model 61 | * 62 | * @param nativeHandle native handle captured before with LoadModel 63 | */ 64 | private native void freeModel(long nativeHandle); 65 | } 66 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/java/com/quicinc/chatapp/MessageSender.java: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | package com.quicinc.chatapp; 6 | 7 | /** 8 | * MessageSender: Enum to represent if message is from BOT or user 9 | */ 10 | enum MessageSender { 11 | BOT, 12 | USER, 13 | }; 14 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/java/com/quicinc/chatapp/StringCallback.java: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------- 2 | // Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 | // SPDX-License-Identifier: BSD-3-Clause 4 | // --------------------------------------------------------------------- 5 | package com.quicinc.chatapp; 6 | 7 | /** 8 | * StringCallBack - Callback to tunnel JNI output into Java 9 | */ 10 | public interface StringCallback { 11 | void onNewString(String str); 12 | } 13 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/res/drawable/bot_response.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | 31 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/res/drawable/text_rounded_corner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/res/drawable/user_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /apps/android/ChatApp/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 20 | 21 |