├── .github ├── CODEOWNERS └── workflows │ ├── canary-aarch64-linux.yml │ ├── canary-al2.yml │ ├── canary-gpu.yml │ ├── canary-m1-mac.yml │ ├── canary-model-zoo.yml │ ├── canary-ubuntu.yml │ ├── canary-windows.yml │ ├── canary.yml │ ├── nightly.yml │ └── publish-job-success.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── android ├── .gitignore ├── gradle.properties ├── gradle │ ├── libs.versions.toml │ └── wrapper │ │ ├── .gitignore │ │ ├── GradleWrapperDownloader.java │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── onnxruntime_android │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── object_detection │ │ ├── README.md │ │ ├── build.gradle.kts │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── ai │ │ │ │ └── djl │ │ │ │ └── examples │ │ │ │ └── objectdetection │ │ │ │ ├── ObjectDetectionActivity.java │ │ │ │ └── ObjectDetectionModel.java │ │ │ └── res │ │ │ ├── color │ │ │ ├── button_selector.xml │ │ │ └── fab_selector.xml │ │ │ ├── drawable-hdpi │ │ │ └── ic_camera.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_camera.png │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable-xhdpi │ │ │ └── ic_camera.png │ │ │ ├── drawable-xxhdpi │ │ │ └── ic_camera.png │ │ │ ├── drawable │ │ │ ├── circle_background.xml │ │ │ ├── ic_camera.xml │ │ │ ├── ic_close.xml │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── settings.gradle.kts └── pytorch_android │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── face_detection │ ├── README.md │ ├── build.gradle.kts │ ├── img │ │ ├── 1.jpeg │ │ └── 2.jpeg │ ├── lint.xml │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── img │ │ │ └── selfie.jpg │ │ ├── java │ │ └── ai │ │ │ └── djl │ │ │ └── examples │ │ │ └── detection │ │ │ ├── FaceApp.java │ │ │ ├── FaceDetectionActivity.java │ │ │ ├── FaceDetectionTranslator.java │ │ │ ├── FaceModel.java │ │ │ ├── domain │ │ │ ├── FaceDetectedObjects.java │ │ │ ├── FaceObject.java │ │ │ └── Landmark.java │ │ │ └── utils │ │ │ └── ImageUtil.java │ │ └── res │ │ ├── drawable │ │ └── border.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values │ │ ├── colors.xml │ │ ├── dimes.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── filepaths.xml │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── img │ ├── banana.gif │ ├── cat.gif │ └── rabbit.gif │ ├── neural_machine_translation │ ├── README.md │ ├── build.gradle.kts │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ ├── source_wrd2idx.json │ │ └── target_idx2wrd.json │ │ ├── java │ │ └── ai │ │ │ └── djl │ │ │ └── examples │ │ │ └── neuralmachinetranslation │ │ │ ├── NMTActivity.java │ │ │ └── NeuralModel.java │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── border.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── quickdraw_recognition │ ├── README.md │ ├── build.gradle.kts │ ├── gradlew │ ├── gradlew.bat │ ├── lint.xml │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── ai │ │ │ └── djl │ │ │ └── examples │ │ │ └── quickdraw │ │ │ ├── Bound.java │ │ │ ├── DoodleApp.java │ │ │ ├── DoodleDrawActivity.java │ │ │ ├── DoodleModel.java │ │ │ └── PaintView.java │ │ └── res │ │ ├── drawable │ │ └── border.xml │ │ ├── layout │ │ └── activity_doodle.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values │ │ ├── colors.xml │ │ ├── dimes.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── filepaths.xml │ ├── semantic_segmentation │ ├── README.md │ ├── build.gradle.kts │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── ai │ │ │ └── djl │ │ │ └── examples │ │ │ └── semanticsegmentation │ │ │ ├── SemanticActivity.java │ │ │ └── SemanticModel.java │ │ └── res │ │ ├── color │ │ └── fab_selector.xml │ │ ├── drawable-hdpi │ │ ├── ic_camera.png │ │ └── ic_close.png │ │ ├── drawable-mdpi │ │ ├── ic_camera.png │ │ └── ic_close.png │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xhdpi │ │ ├── ic_camera.png │ │ └── ic_close.png │ │ ├── drawable-xxhdpi │ │ ├── ic_camera.png │ │ └── ic_close.png │ │ ├── drawable │ │ ├── ic_camera.xml │ │ ├── ic_close.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── settings.gradle.kts │ ├── speech_recognition │ ├── README.md │ ├── build.gradle.kts │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── ai │ │ │ └── djl │ │ │ └── examples │ │ │ └── speechrecognition │ │ │ ├── SpeechRecognitionActivity.java │ │ │ └── SpeechRecognitionModel.java │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── style_transfer_cyclegan │ ├── README.md │ ├── build.gradle.kts │ ├── gradlew │ ├── gradlew.bat │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── ai │ │ │ └── djl │ │ │ └── examples │ │ │ └── styletransfer │ │ │ ├── StyleTransferActivity.kt │ │ │ ├── StyleTransferModel.kt │ │ │ └── Styler.kt │ │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── web_hi_res_512.png ├── apache-beam └── ctr-prediction │ ├── README.md │ ├── pom.xml │ └── src │ └── main │ └── java │ └── org │ └── example │ └── ctrprediction │ └── CtrPrediction.java ├── apache-flink ├── image-classification │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── EMI.java │ │ ├── dataset │ │ └── S3ImageDataset.java │ │ └── ml │ │ └── Classifier.java ├── sentence_embedding │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── SentenceEncoder.java └── sentiment-analysis │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ ├── img │ └── flink.gif │ └── src │ └── main │ └── java │ └── com │ └── example │ └── SentimentAnalysis.java ├── apache-kafka ├── .gitignore ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradlew ├── src │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── ConsumerLoop.java │ │ └── SentimentAnalysis.java └── start_service.sh ├── apache-spark ├── image-classification │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── build.sbt │ ├── gradle.properties │ ├── gradlew │ ├── images │ │ ├── car.jpg │ │ ├── cat.jpg │ │ └── dog.jpg │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── examples │ │ ├── DataProcessExample.scala │ │ └── ImageClassificationExample.scala ├── notebook │ ├── Image_Classification_Spark.ipynb │ ├── Text_Embedding_Spark.ipynb │ ├── Text_Encoding_Spark.ipynb │ └── Text_Tokenization_Spark.ipynb └── spark3.0 │ ├── audio-pyspark │ ├── README.md │ ├── speech_recognition.py │ └── whisper_speech_recognition.py │ ├── audio │ ├── README.md │ ├── build.gradle.kts │ ├── build.sbt │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── examples │ │ └── SpeechRecognitionExample.scala │ ├── binary-pyspark │ ├── README.md │ └── image_classification_np.py │ ├── image-pyspark │ ├── README.md │ ├── image_classification.py │ ├── object_detection.py │ └── semantic_segmentation.py │ ├── image │ ├── README.md │ ├── build.gradle.kts │ ├── build.sbt │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle.kts │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── examples │ │ ├── ImageClassificationExample.scala │ │ ├── ObjectDetectionExample.scala │ │ └── SemanticSegmentationExample.scala │ ├── text-pyspark │ ├── README.md │ ├── question_answering.py │ ├── text2text_generation_alpaca.py │ ├── text2text_generation_t5.py │ ├── text_classification.py │ ├── text_embedding.py │ ├── text_encoding.py │ ├── text_generation.py │ └── text_tokenization.py │ └── text │ ├── README.md │ ├── build.gradle.kts │ ├── build.sbt │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle.kts │ └── src │ └── main │ └── scala │ └── com │ └── examples │ ├── QuestionAnsweringExample.scala │ ├── TextClassificationExample.scala │ ├── TextEmbeddingExample.scala │ ├── TextEncodingExample.scala │ └── TextTokenizationExample.scala ├── aws ├── aws-kinesis-video-streams │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── examples │ │ ├── App.java │ │ ├── AppOnFile.java │ │ └── DjlImageVisitor.java ├── beanstalk-model-serving │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── cleanup.sh │ ├── deploy.sh │ ├── elasticbeanstalk-role.json │ ├── gradle.properties │ ├── gradlew │ ├── options.json │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── doodle │ │ │ ├── DoodleApplication.java │ │ │ └── DoodleController.java │ │ └── resources │ │ ├── application.yml │ │ └── static │ │ ├── app.css │ │ ├── app.js │ │ └── index.html ├── emr-distributed-inference │ ├── dataprocess │ │ ├── README.md │ │ ├── build.gradle.kts │ │ ├── gradle.properties │ │ ├── gradlew │ │ ├── img │ │ │ └── configure emr.gif │ │ └── src │ │ │ └── main │ │ │ └── scala │ │ │ └── com │ │ │ └── examples │ │ │ └── DataProcessExample.scala │ └── image-classification-gpu │ │ ├── README.md │ │ ├── build.gradle.kts │ │ ├── configurations.json │ │ ├── emr-prepare.sh │ │ ├── gradle.properties │ │ ├── gradlew │ │ ├── install_rapid.sh │ │ ├── install_spark.sh │ │ └── src │ │ └── main │ │ └── scala │ │ └── com │ │ └── examples │ │ └── ImageClassificationExample.scala ├── inferentia │ ├── README.md │ ├── build.gradle.kts │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ ├── inf1.md │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── inferentia │ │ │ │ ├── Benchmark.java │ │ │ │ └── InferentiaDemo.java │ │ │ └── resources │ │ │ ├── log4j2.xml │ │ │ └── synset.txt │ ├── trace_inf1.py │ └── trace_inf2.py ├── lambda-model-serving │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── cleanup.sh │ ├── deploy.sh │ ├── gradle.properties │ ├── gradlew │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── examples │ │ │ │ ├── Handler.java │ │ │ │ └── Request.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── examples │ │ │ ├── HandlerTest.java │ │ │ ├── MockContext.java │ │ │ └── MockLogger.java │ └── template.yml └── sagemaker │ ├── Multi-Model-Inference-Demo.ipynb │ ├── README.md │ ├── large-model-inference │ ├── .gitignore │ ├── BYOC_template_with_LMI_solution.ipynb │ ├── README.md │ ├── pysdk_template_with_LMI_solution.ipynb │ └── sample-llm │ │ ├── aws-under-the-hood-neuron-demo.ipynb │ │ ├── deprecated │ │ ├── ds_deploy_llama2-13b-smoothquant.ipynb │ │ ├── ds_rollingbatch_deploy_gpt-neox-20b-smoothquant.ipynb │ │ ├── ds_rollingbatch_deploy_llama2-13b-smoothquant.ipynb │ │ └── fastertransformer_deploy_pythia12b_triton_mode.ipynb │ │ ├── hf_acc_deploy_codellama_34b.ipynb │ │ ├── hf_acc_deploy_falcon_40b.ipynb │ │ ├── hf_acc_deploy_llama2_13b_gptq.ipynb │ │ ├── hf_acc_deploy_llama2_70b-2.ipynb │ │ ├── hf_acc_deploy_llama2_70b.ipynb │ │ ├── hf_acc_deploy_llama_7b_customized_preprocessing.ipynb │ │ ├── hf_acc_deploy_mistral_7b.ipynb │ │ ├── lmi-async-inference-demo.ipynb │ │ ├── lookahead_decoding_llama_7b.ipynb │ │ ├── multi-modal-llava-v1-6.ipynb │ │ ├── multi-modal-mllama-11b.ipynb │ │ ├── multi-modal-pixtral-12b.ipynb │ │ ├── multi_lora_adapter_inference.ipynb │ │ ├── multi_lora_adapter_inference_custom.ipynb │ │ ├── reranking_bge_reranker_v2_m3.ipynb │ │ ├── rollingbatch_deploy_codegen25_7b.ipynb │ │ ├── rollingbatch_deploy_codellama_34b.ipynb │ │ ├── rollingbatch_deploy_falcon_40b.ipynb │ │ ├── rollingbatch_deploy_flan_ul2.ipynb │ │ ├── rollingbatch_deploy_llama2-13b-gptq.ipynb │ │ ├── rollingbatch_deploy_llama2-70b-gptq.ipynb │ │ ├── rollingbatch_deploy_llama2_70b.ipynb │ │ ├── rollingbatch_deploy_mixtral_8x7b.ipynb │ │ ├── rollingbatch_deploy_mpt_30b.ipynb │ │ ├── rollingbatch_deploy_octocoder_w_pagedattn.ipynb │ │ ├── rollingbatch_llama_7b_chat.ipynb │ │ ├── rollingbatch_llama_7b_customized_preprocessing.ipynb │ │ ├── rollingbatch_llama_7b_stop_reason.ipynb │ │ ├── stateful_inference_llama3_8b.ipynb │ │ ├── text_embedding_deploy_bert.ipynb │ │ ├── tnx_rollingbatch_deploy_llama_13b.ipynb │ │ ├── tnx_rollingbatch_deploy_llama_70b.ipynb │ │ ├── tnx_rollingbatch_deploy_llama_7b_int8.ipynb │ │ ├── tnx_rollingbatch_deploy_mistral_7b.ipynb │ │ ├── tnx_rollingbatch_deploy_opt.ipynb │ │ ├── tnx_speculative_decoding_deploy_llama2_70b.ipynb │ │ ├── trtllm_dynamicbatch_flant5-xl.ipynb │ │ ├── trtllm_rollingbatch_deploy_baichuan2_13b.ipynb │ │ ├── trtllm_rollingbatch_deploy_chatglm3_6b.ipynb │ │ ├── trtllm_rollingbatch_deploy_customized_processing.ipynb │ │ ├── trtllm_rollingbatch_deploy_llama_13b.ipynb │ │ ├── trtllm_rollingbatch_deploy_mixtral_8x7b.ipynb │ │ ├── trtllm_rollingbatch_deploy_qwen_7b.ipynb │ │ ├── utils │ │ ├── LineIterator.py │ │ └── __init__.py │ │ ├── vllm_deploy_llama_13b.ipynb │ │ ├── vllm_deploy_mistral_7b.ipynb │ │ ├── vllm_rollingbatch_deploy_Mixtral-8x7B-DPO-AWQ.ipynb │ │ ├── vllm_rollingbatch_deploy_customized_processing.ipynb │ │ ├── vllm_rollingbatch_deploy_mixtral_8x7b.ipynb │ │ ├── vllm_rollingbatch_deploy_mixtral_8x7b_quantized_AWQ.ipynb │ │ ├── vllm_rollingbatch_deploy_yi_34B_chat_4bits_AWQ.ipynb │ │ └── zero_shot_image_classification_grounding-dino-base.ipynb │ ├── llm-instance-recommend │ ├── .gitignore │ ├── README.md │ ├── lmi_recommender │ │ ├── __init__.py │ │ ├── instance_recommender.py │ │ ├── ir_strategy_maker.py │ │ └── lmi_config_recommender.py │ └── setup.py │ ├── notebook │ └── README.md │ ├── processing │ ├── djl_sagemaker_spark_processing_binary │ │ ├── code │ │ │ └── process.py │ │ └── djl_sagemaker_spark_processing_binary.ipynb │ ├── djl_sagemaker_spark_processing_image_classification │ │ ├── code │ │ │ └── process.py │ │ └── djl_sagemaker_spark_processing_image_classification.ipynb │ ├── djl_sagemaker_spark_processing_text2text_generation │ │ ├── code │ │ │ └── process.py │ │ └── djl_sagemaker_spark_processing_text2text_generation.ipynb │ ├── djl_sagemaker_spark_processing_text_classification │ │ ├── code │ │ │ └── process.py │ │ └── djl_sagemaker_spark_processing_text_classification.ipynb │ ├── djl_sagemaker_spark_processing_text_generation │ │ ├── code │ │ │ └── process.py │ │ └── djl_sagemaker_spark_processing_text_generation.ipynb │ └── djl_sagemaker_spark_processing_whisper_speech_recognition │ │ ├── code │ │ └── process.py │ │ └── djl_sagemaker_spark_processing_whisper_speech_recognition.ipynb │ └── studio │ ├── Dockerfile │ ├── README.md │ ├── gpu.Dockerfile │ └── image.gif ├── bom ├── build.gradle.kts ├── gradle.properties ├── gradlew └── settings.gradle.kts ├── build.gradle.kts ├── camel-djl ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── one │ │ │ └── entropy │ │ │ └── demo │ │ │ └── camel │ │ │ └── djl │ │ │ └── Demo.java │ └── resources │ │ └── logback.xml │ └── test │ └── resources │ └── 10.png ├── canary ├── build.gradle.kts ├── gradle ├── gradle.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── java │ └── ai │ │ └── djl │ │ └── canary │ │ ├── CanaryTest.java │ │ ├── ModelZooTest.java │ │ └── package-info.java │ └── resources │ └── log4j2.xml ├── development ├── fatjar │ ├── .gitignore │ ├── .mvn │ │ └── wrapper │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── build.gradle.kts │ ├── build.sbt │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ ├── project │ │ ├── build.properties │ │ └── plugins.sbt │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── examples │ │ └── FatJar.java ├── module │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── java │ │ ├── module-info.java │ │ └── org │ │ │ └── examples │ │ │ └── module │ │ │ ├── ModuleTest.java │ │ │ └── package-info.java │ │ └── resources │ │ └── log4j2.xml ├── multi-engine │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ ├── performance_numbers.md │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── examples │ │ │ │ └── MultiEngine.java │ │ └── resources │ │ │ └── log4j2.xml │ │ └── test │ │ └── resources │ │ ├── joints.png │ │ └── pose_soccer.png └── python │ ├── README.md │ ├── build.gradle.kts │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ ├── main │ └── java │ │ └── com │ │ └── examples │ │ ├── BetterSolution.java │ │ ├── PythonTranslator.java │ │ ├── SimpleSolution.java │ │ └── util │ │ ├── ProcessingModel.java │ │ └── Resnet18Model.java │ └── test │ └── resources │ └── resnet18 │ ├── index_to_name.json │ ├── model.py │ └── requirements.txt ├── djl-serving ├── README.md ├── binary-mode │ ├── README.md │ └── inference.py ├── java-client │ ├── .gitignore │ ├── README.md │ ├── build.gradle.kts │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── djl │ │ └── examples │ │ └── serving │ │ └── javaclient │ │ ├── DJLServingClientExample1.java │ │ ├── DJLServingClientExample2.java │ │ ├── DJLServingClientExample3.java │ │ ├── DJLServingClientExample4.java │ │ └── HttpUtils.java ├── java-mode │ ├── README.md │ └── devEnv │ │ ├── .gitignore │ │ ├── build.gradle.kts │ │ ├── gradle │ │ ├── gradle.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── examples │ │ ├── CustomTranslator.java │ │ └── CustomTranslatorFactory.java ├── multi-node │ ├── README.md │ ├── eks-cluster.yaml │ ├── lws.yaml │ └── service.yaml ├── postman-client │ ├── DJLServing.postman_collection.json │ └── README.md ├── python-client │ ├── .gitignore │ ├── README.md │ ├── djlserving_client_example1.py │ ├── djlserving_client_example2.py │ ├── djlserving_client_example3.py │ └── djlserving_client_example4.py ├── python-mode │ ├── README.md │ ├── resnet18 │ │ ├── index_to_name.json │ │ ├── model.py │ │ └── requirements.txt │ ├── stable-diffusion │ │ ├── docs │ │ │ ├── README.md │ │ │ └── img │ │ │ │ ├── img2img.png │ │ │ │ ├── inference.png │ │ │ │ ├── model-list.png │ │ │ │ └── text2text.png │ │ ├── model.py │ │ └── requirements.txt │ └── zero-shot-image-classification │ │ ├── model.py │ │ └── requirements.txt ├── wlm │ └── flink-sentiment-analysis │ │ ├── README.md │ │ ├── build.gradle.kts │ │ ├── gradle.properties │ │ ├── gradlew │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── SentimentAnalysis.java └── workflows │ ├── java-pre-post-processing │ ├── README.md │ ├── function │ │ ├── build.gradle.kts │ │ ├── gradle │ │ ├── gradle.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── org │ │ │ │ └── example │ │ │ │ ├── PostprocessWF.java │ │ │ │ └── PreprocessWF.java │ │ │ └── resources │ │ │ └── synset.txt │ └── workflow.json │ ├── multi-model │ ├── README.md │ ├── function │ │ ├── build.gradle.kts │ │ ├── gradle │ │ ├── gradle.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── org │ │ │ └── example │ │ │ ├── DetectedObjectsDeserializer.java │ │ │ └── ExtractPersonWF.java │ └── workflow.json │ ├── python-pre-post-processing │ ├── README.md │ ├── postprocess │ │ ├── index_to_name.json │ │ ├── model.py │ │ └── requirements.txt │ ├── preprocess │ │ ├── model.py │ │ └── requirements.txt │ └── workflow.json │ └── python │ ├── README.md │ ├── resnet18 │ ├── index_to_name.json │ ├── model.py │ └── requirements.txt │ └── workflow.json ├── footwear_classification ├── .gitignore ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradlew └── src │ └── main │ └── java │ └── com │ └── examples │ ├── Inference.java │ ├── Models.java │ └── Training.java ├── genai ├── build.gradle.kts ├── gradlew └── src │ └── main │ └── java │ └── org │ └── example │ ├── ChatCompletion.java │ ├── ChatCompletionWithStream.java │ ├── ChatCompletionWithTools.java │ ├── ImageUnderstanding.java │ └── SimpleRestApi.java ├── graalvm ├── .mvn │ └── wrapper │ │ ├── .gitignore │ │ ├── MavenWrapperDownloader.java │ │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── example │ ├── GraalvmImageFactory.java │ └── ImageClassification.java ├── gradle.properties ├── gradle └── wrapper │ ├── .gitignore │ ├── GradleWrapperDownloader.java │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── huggingface ├── .gitignore ├── hybrid │ ├── README.md │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ ├── models │ │ ├── download_models.py │ │ ├── example_inputs │ │ │ ├── question_answering.json │ │ │ ├── text_classification.txt │ │ │ └── token_classification.txt │ │ ├── hybrid │ │ │ ├── model.py │ │ │ ├── question_answering.py │ │ │ ├── question_answering_config.json │ │ │ ├── text_classification.py │ │ │ ├── text_classification_config.json │ │ │ ├── text_classification_labels.json │ │ │ ├── token_classification.py │ │ │ ├── token_classification_config.json │ │ │ ├── token_classification_labels.json │ │ │ └── transformers_model.py │ │ └── requirements.txt │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── examples │ │ │ ├── HybridPythonEngine.java │ │ │ └── QuestionAnswering.java │ │ └── resources │ │ └── log4j2.xml ├── inferentia │ ├── .gitignore │ ├── README.md │ ├── SageMaker-Role-Policy.json │ ├── deploy_on_sagemaker.md │ ├── question_answering │ │ ├── model.py │ │ ├── requirements.txt │ │ └── serving.properties │ ├── requirements.txt │ └── trace.py ├── nlp │ ├── build.gradle.kts │ ├── gradle │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── examples │ │ ├── FillMask.java │ │ ├── QuestionAnswering.java │ │ ├── Reranking.java │ │ ├── TextClassification.java │ │ ├── TextEmbedding.java │ │ └── TokenClassification.java └── python │ ├── example_inputs │ ├── question_answering.json │ ├── text_classification.txt │ └── token_classification.txt │ ├── question_answering │ ├── model.py │ └── settings.json │ ├── requirements.txt │ ├── text_classification │ ├── labels.json │ ├── model.py │ └── settings.json │ └── token_classification │ ├── labels.json │ ├── model.py │ └── settings.json ├── jupyter ├── .gitignore ├── BERTQA.ipynb ├── Dockerfile ├── README.md ├── build.gradle.kts ├── docker-compose.yml ├── gradle ├── gradle.properties ├── gradlew ├── load_mxnet_model.ipynb ├── load_pytorch_model.ipynb ├── mxnet │ └── load_your_own_mxnet_bert.ipynb ├── object_detection_with_model_zoo.ipynb ├── onnxruntime │ └── machine_learning_with_ONNXRuntime.ipynb ├── pytorch │ └── load_your_own_pytorch_bert.ipynb ├── rank_classification_using_BERT_on_Amazon_Review.ipynb ├── tensorflow │ ├── pneumonia_detection.ipynb │ └── rank_classification_using_BERT_on_Amazon_Review.ipynb ├── test_notebook.sh ├── transfer_learning_on_cifar10.ipynb └── tutorial │ ├── 01_create_your_first_network.ipynb │ ├── 02_train_your_first_model.ipynb │ ├── 03_image_classification_with_your_model.ipynb │ └── README.md ├── live-object-detection ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ └── java │ └── com │ └── examples │ ├── ViewerFrame.java │ └── WebCam.java ├── malicious-url-detector ├── README.md ├── build.gradle.kts ├── docs │ ├── convolutional_layers.png │ ├── correct_firefox.png │ ├── dataset_creation.md │ ├── define_model.md │ ├── dense_layer.png │ ├── proxy_firefox.png │ ├── training_model.md │ ├── translators.md │ └── wrong_url_firefox.png ├── gradle ├── gradle.properties ├── gradlew ├── gradlew.bat ├── index.html └── src │ └── main │ └── java │ └── com │ └── example │ ├── CSVDataset.java │ ├── FilterProxy.java │ ├── MaliciousURLModel.java │ ├── ModelTrainer.java │ ├── RequestHandler.java │ └── URLTranslator.java ├── pneumonia-detection ├── .gitignore ├── README.md ├── build.gradle.kts ├── gradle ├── gradle.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ └── java │ └── com │ └── examples │ └── PneumoniaDetection.java ├── quarkus ├── example │ ├── .dockerignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── .gitignore │ │ │ ├── MavenWrapperDownloader.java │ │ │ └── maven-wrapper.properties │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── docker │ │ │ ├── Dockerfile.jvm │ │ │ └── Dockerfile.native │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ImageClassification.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── ImageClassificationTest.java ├── extension-example │ ├── .dockerignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── .gitignore │ │ │ ├── MavenWrapperDownloader.java │ │ │ └── maven-wrapper.properties │ ├── .s2i │ │ └── environment │ ├── README.md │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ └── main │ │ ├── docker │ │ ├── Dockerfile.jvm │ │ └── Dockerfile.native │ │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── getting │ │ │ └── started │ │ │ └── DjlResource.java │ │ └── resources │ │ └── application.properties └── extension │ ├── README.md │ ├── deployment │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── djl │ │ └── quarkus │ │ └── deployment │ │ ├── DjlModelBuildItem.java │ │ └── DjlPredictorProcessor.java │ ├── pom.xml │ └── runtime │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── ai │ │ └── djl │ │ └── quarkus │ │ └── runtime │ │ ├── DjlModelConfiguration.java │ │ ├── DjlPredictorProducer.java │ │ └── DjlPredictorRecorder.java │ └── resources │ └── META-INF │ └── quarkus-extension.yaml ├── settings.gradle.kts ├── tools └── gradle │ └── javaFormatter.gradle.kts ├── visualization-vue ├── .gitignore ├── README.md ├── djl-training-demo │ ├── .mvn │ │ └── wrapper │ │ │ ├── .gitignore │ │ │ └── maven-wrapper.properties │ ├── mvnw │ ├── mvnw.cmd │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── example │ │ │ │ ├── MonitorApplication.java │ │ │ │ ├── controller │ │ │ │ ├── InferController.java │ │ │ │ └── trainController.java │ │ │ │ ├── domain │ │ │ │ └── ResultBean.java │ │ │ │ ├── inference │ │ │ │ └── ImageClassification.java │ │ │ │ ├── service │ │ │ │ ├── InferService.java │ │ │ │ └── TrainService.java │ │ │ │ └── training │ │ │ │ ├── MnistTraining.java │ │ │ │ ├── common │ │ │ │ └── Arguments.java │ │ │ │ ├── data │ │ │ │ ├── MetricInfo.java │ │ │ │ ├── ModelInfo.java │ │ │ │ └── TrainerInfo.java │ │ │ │ ├── listener │ │ │ │ ├── CheckpointsTrainingListener.java │ │ │ │ └── UiTrainingListener.java │ │ │ │ └── verticle │ │ │ │ ├── DataVerticle.java │ │ │ │ └── WebVerticle.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── resources │ │ └── 0.png ├── djl-training-ui │ ├── .editorconfig │ ├── .env.development │ ├── .env.production │ ├── .env.staging │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .travis.yml │ ├── babel.config.js │ ├── jest.config.js │ ├── jsconfig.json │ ├── package.json │ ├── postcss.config.js │ ├── public │ │ ├── favicon.png │ │ └── index.html │ ├── src │ │ ├── App.vue │ │ ├── api │ │ │ ├── inference.js │ │ │ └── training.js │ │ ├── assets │ │ │ └── 404_images │ │ │ │ ├── 404.png │ │ │ │ └── 404_cloud.png │ │ ├── components │ │ │ ├── Breadcrumb │ │ │ │ └── index.vue │ │ │ ├── Hamburger │ │ │ │ └── index.vue │ │ │ └── SvgIcon │ │ │ │ └── index.vue │ │ ├── layout │ │ │ ├── components │ │ │ │ ├── AppMain.vue │ │ │ │ ├── Navbar.vue │ │ │ │ ├── Sidebar │ │ │ │ │ ├── FixiOSBug.js │ │ │ │ │ ├── Item.vue │ │ │ │ │ ├── Link.vue │ │ │ │ │ ├── Logo.vue │ │ │ │ │ ├── SidebarItem.vue │ │ │ │ │ └── index.vue │ │ │ │ └── index.js │ │ │ ├── index.vue │ │ │ └── mixin │ │ │ │ └── ResizeHandler.js │ │ ├── main.js │ │ ├── permission.js │ │ ├── router │ │ │ └── index.js │ │ ├── settings.js │ │ ├── store │ │ │ ├── getters.js │ │ │ ├── index.js │ │ │ └── modules │ │ │ │ ├── app.js │ │ │ │ └── settings.js │ │ ├── styles │ │ │ ├── element-ui.scss │ │ │ ├── index.scss │ │ │ ├── mixin.scss │ │ │ ├── sidebar.scss │ │ │ ├── transition.scss │ │ │ └── variables.scss │ │ ├── utils │ │ │ ├── get-page-title.js │ │ │ ├── index.js │ │ │ ├── request.js │ │ │ └── validate.js │ │ └── views │ │ │ ├── 404.vue │ │ │ ├── dashboard │ │ │ ├── components │ │ │ │ └── LineChart.vue │ │ │ ├── index.vue │ │ │ └── mixins │ │ │ │ └── resize.js │ │ │ └── inference │ │ │ └── index.vue │ ├── tests │ │ └── unit │ │ │ ├── .eslintrc.js │ │ │ ├── components │ │ │ ├── Breadcrumb.spec.js │ │ │ ├── Hamburger.spec.js │ │ │ └── SvgIcon.spec.js │ │ │ └── utils │ │ │ ├── formatTime.spec.js │ │ │ ├── param2Obj.spec.js │ │ │ ├── parseTime.spec.js │ │ │ └── validate.spec.js │ └── vue.config.js ├── inference.png └── training.png └── web-demo ├── doodle_game ├── backend │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradlew │ └── src │ │ └── main │ │ └── java │ │ └── ai │ │ └── djl │ │ └── examples │ │ └── doodle │ │ ├── Handler.java │ │ └── Request.java └── frontend │ ├── app.css │ ├── app.js │ └── index.html └── interactive-console ├── README.md ├── build.gradle.kts ├── gradle.properties ├── gradlew ├── img ├── blockrunner.gif └── terminal.gif ├── settings.gradle.kts └── src └── main ├── java └── ai │ └── djl │ └── examples │ └── jshell │ ├── BlockRunnerController.java │ ├── InteractiveShell.java │ ├── JshellApplication.java │ ├── ShellController.java │ └── ShellSpawner.java ├── resources ├── application.properties └── starter │ ├── gradle │ └── wrapper │ │ ├── GradleWrapperDownloader.java │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── mxnet.gradle.kts │ ├── pytorch.gradle.kts │ ├── settings.gradle.kts │ └── tensorflow.gradle.kts └── webapps ├── blockrunner ├── app.js └── index.html └── jshell ├── app.js └── index.html /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Global Owners 2 | * @zachgk @frankfliu @DeepJavaLibrary/djl-admin 3 | -------------------------------------------------------------------------------- /.github/workflows/nightly.yml: -------------------------------------------------------------------------------- 1 | name: DJL Demo Nightly test 2 | 3 | on: 4 | schedule: 5 | - cron: '0 3 * * *' 6 | workflow_dispatch: 7 | 8 | 9 | jobs: 10 | compile-test: 11 | if: github.repository == 'deepjavalibrary/djl-demo' 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - name: Set up JDK 17 16 | uses: actions/setup-java@v3 17 | with: 18 | distribution: 'corretto' 19 | java-version: 17 20 | - name: Compile all gradle projects 21 | run: ./gradlew build 22 | - name: Compile Apache Beam 23 | working-directory: apache-beam/ctr-prediction 24 | run: mvn package 25 | - name: Compile Apache Camel 26 | working-directory: camel-djl 27 | run: mvn package 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | bin/ 6 | 7 | # IntelliJ 8 | .idea 9 | *.ipr 10 | *.iml 11 | *.iws 12 | 13 | # NetBeans 14 | nbconfiguration.xml 15 | 16 | # Visual Studio Code 17 | .vscode 18 | .factorypath 19 | 20 | # OSX 21 | .DS_Store 22 | 23 | # Vim 24 | *.swp 25 | *.swo 26 | 27 | # patch 28 | *.orig 29 | *.rej 30 | 31 | # Maven 32 | target/ 33 | pom.xml.tag 34 | pom.xml.releaseBackup 35 | pom.xml.versionsBackup 36 | release.properties 37 | 38 | # Gradle 39 | .gradle 40 | build/ 41 | out/ 42 | 43 | __pycache__/ 44 | 45 | *.gz 46 | *.jar 47 | *.zip 48 | *.tar 49 | *.pt 50 | *.h5 51 | *.params 52 | *.log 53 | model/ 54 | dataset/ 55 | 56 | stats.json 57 | coverage 58 | storybookstatic 59 | node/ 60 | node_modules/ 61 | dist/ 62 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 4 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 5 | opensource-codeofconduct@amazon.com with any additional questions or comments. 6 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | local.properties 2 | -------------------------------------------------------------------------------- /android/gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.5.1" 3 | appcompat = "1.7.0" 4 | cameraCore = "1.3.4" 5 | constraintlayout = "2.1.4" 6 | kotlin = "1.9.0" 7 | coreKtx = "1.13.1" 8 | material = "1.12.0" 9 | 10 | [libraries] 11 | androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } 12 | androidx-camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "cameraCore" } 13 | androidx-camera-core = { module = "androidx.camera:camera-core", version.ref = "cameraCore" } 14 | androidx-camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "cameraCore" } 15 | androidx-camera-view = { module = "androidx.camera:camera-view", version.ref = "cameraCore" } 16 | androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" } 17 | androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } 18 | material = { module = "com.google.android.material:material", version.ref = "material" } 19 | 20 | [plugins] 21 | android-application = { id = "com.android.application", version.ref = "agp" } 22 | jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } 23 | -------------------------------------------------------------------------------- /android/gradle/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | GradleWrapperDownloader.class -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jan 16 22:46:13 PST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 7 | -------------------------------------------------------------------------------- /android/onnxruntime_android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea/ 3 | .gradle/ 4 | build/ 5 | local.properties 6 | captures/ 7 | keystore 8 | .externalNativeBuild 9 | .cxx -------------------------------------------------------------------------------- /android/onnxruntime_android/README.md: -------------------------------------------------------------------------------- 1 | # DJL Android demos for OnnxRuntime 2 | 3 | This demo project include several fun apps with DJL. 4 | 5 | ## [Object_Detection](object_detection/README.md) 6 | -------------------------------------------------------------------------------- /android/onnxruntime_android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | -------------------------------------------------------------------------------- /android/onnxruntime_android/gradle: -------------------------------------------------------------------------------- 1 | ../gradle -------------------------------------------------------------------------------- /android/onnxruntime_android/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /android/onnxruntime_android/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /android/onnxruntime_android/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/README.md: -------------------------------------------------------------------------------- 1 | # Object_detection 2 | 3 | In this example, you will see how to do object detection with a pre-trained 4 | [yolov5](https://github.com/ultralytics/yolov5) model. You 5 | will identify objects in images and box them in based on the type of object it is. 6 | 7 | ### Setup 8 | Use the following command to install this app on your Android phone: 9 | 10 | ``` 11 | cd object_detection 12 | 13 | # for Linux/macOS 14 | ./gradlew iD 15 | 16 | # for Windows 17 | ..\gradlew.bat iD 18 | ``` 19 | 20 | It will install the Object Detection application on your Android phone. 21 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/color/button_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/color/fab_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable-hdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/drawable-hdpi/ic_camera.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable-mdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/drawable-mdpi/ic_camera.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable-xhdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/drawable-xhdpi/ic_camera.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable-xxhdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/drawable-xxhdpi/ic_camera.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable/circle_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 7 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable/ic_camera.xml: -------------------------------------------------------------------------------- 1 | 8 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/drawable/ic_close.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/onnxruntime_android/object_detection/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #4DB6AC 6 | #80CBC4 7 | #009688 8 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 32dp 4 | 48dp 5 | 64dp 6 | 360dp 7 | 280dp 8 | 9 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Object Detection - Powered by DJL 3 | Downloading the model… 4 | Download model complete 5 | Error 6 | Download model failed 7 | -------------------------------------------------------------------------------- /android/onnxruntime_android/object_detection/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /android/onnxruntime_android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google { 4 | content { 5 | includeGroupByRegex("com\\.android.*") 6 | includeGroupByRegex("com\\.google.*") 7 | includeGroupByRegex("androidx.*") 8 | } 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | dependencyResolutionManagement { 15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 16 | repositories { 17 | google() 18 | mavenCentral() 19 | maven("https://central.sonatype.com/repository/maven-snapshots/") 20 | maven("https://oss.sonatype.org/service/local/repositories/${System.getenv("DJL_STAGING")}/content/") 21 | } 22 | } 23 | 24 | rootProject.name = "android" 25 | 26 | include(":object_detection") 27 | -------------------------------------------------------------------------------- /android/pytorch_android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea/ 3 | .gradle/ 4 | build/ 5 | local.properties 6 | captures/ 7 | keystore 8 | .externalNativeBuild 9 | .cxx -------------------------------------------------------------------------------- /android/pytorch_android/README.md: -------------------------------------------------------------------------------- 1 | # DJL Android demos for PyTorch 2 | 3 | This demo project include several fun apps with DJL. 4 | 5 | ## [Face detection](face_detection/README.md) 6 | ## [Neural Machine Translation](neural_machine_translation/README.md) 7 | ## [QuickDraw Doodle recognition](quickdraw_recognition/README.md) 8 | ## [Semantic Segmentation](semantic_segmentation/README.md) 9 | ## [Speech recognition](speech_recognition/README.md) 10 | ## [Style Transfer](style_transfer_cyclegan/README.md) 11 | -------------------------------------------------------------------------------- /android/pytorch_android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/README.md: -------------------------------------------------------------------------------- 1 | # DJL Android Demo 2 | 3 | # Introduction 4 | 5 | In this example, you learn how to implement inference code with a pytorch model to detect faces in an image. 6 | 7 | Lightweight model: 8 | The model github can be found at [Ultra-Light-Fast-Generic-Face-Detector-1MB](https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB). 9 | 10 | ## Face Detection 11 | 12 | | Sample 1 | Sample 2 | 13 | |:---------------:|:---------------:| 14 | | ![](img/1.jpeg) | ![](img/2.jpeg) | 15 | 16 | 17 | The minimum API level for this project is 26. 18 | 19 | ### Setup 20 | 21 | Use the following command to install this app on your Android phone: 22 | 23 | ``` 24 | cd face_detection 25 | 26 | # for Linux/macOS 27 | ./gradlew iD 28 | 29 | # for Windows 30 | ..\gradlew iD 31 | ``` 32 | 33 | It will install the application your Android phone. 34 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/img/1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/img/1.jpeg -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/img/2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/img/2.jpeg -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/assets/img/selfie.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/src/main/assets/img/selfie.jpg -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/java/ai/djl/examples/detection/FaceApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package ai.djl.examples.detection; 14 | 15 | import android.app.Application; 16 | 17 | import java.io.File; 18 | 19 | public class FaceApp extends Application { 20 | 21 | @Override 22 | public void onCreate() { 23 | super.onCreate(); 24 | File dir = getFilesDir(); 25 | System.setProperty("DJL_CACHE_DIR", dir.getAbsolutePath()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/java/ai/djl/examples/detection/domain/Landmark.java: -------------------------------------------------------------------------------- 1 | package ai.djl.examples.detection.domain; 2 | 3 | import ai.djl.modality.cv.output.Point; 4 | 5 | import java.util.List; 6 | 7 | public class Landmark { 8 | private List points; 9 | 10 | public Landmark(List points) { 11 | this.points = points; 12 | } 13 | 14 | public List getPoints() { 15 | return points; 16 | } 17 | 18 | public void setPoints(List points) { 19 | this.points = points; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/drawable/border.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/face_detection/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/values/dimes.xml: -------------------------------------------------------------------------------- 1 | 2 | 15sp 3 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FaceDetector 3 | clear 4 | Image preview 5 | Face Detection - Powered by DJL 6 | Share 7 | 8 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/pytorch_android/face_detection/src/main/res/xml/filepaths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /android/pytorch_android/gradle: -------------------------------------------------------------------------------- 1 | ../gradle -------------------------------------------------------------------------------- /android/pytorch_android/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /android/pytorch_android/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /android/pytorch_android/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\gradlew.bat -------------------------------------------------------------------------------- /android/pytorch_android/img/banana.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/img/banana.gif -------------------------------------------------------------------------------- /android/pytorch_android/img/cat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/img/cat.gif -------------------------------------------------------------------------------- /android/pytorch_android/img/rabbit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/img/rabbit.gif -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/README.md: -------------------------------------------------------------------------------- 1 | # Neural Machine Translation 2 | 3 | In this example, you will see how to do Neural Machine Translation with pre-trained 4 | encoder and decoder models. You 5 | will translate text from French to English using two different models. First, the French input will 6 | go through the encoder model, and then through the decoder model to be converted into English text. 7 | 8 | To use the app, type in some French text (e.g. trop tard). Then press the translate button and the translated text 9 | in English will appear in the lower box. If you want to try different French text, simply delete 10 | what you originally typed in, and replace it with your desired text. 11 | 12 | ![](https://resources.djl.ai/demo/pytorch/android/neural_machine_translation/NMTexample1.png) 13 | 14 | 15 | ### Setup 16 | Use the following command to install this app on your Android phone: 17 | 18 | ``` 19 | cd neural_machine_translation 20 | 21 | # for Linux/macOS 22 | ./gradlew iD 23 | 24 | # for Windows 25 | ..\gradlew iD 26 | ``` 27 | 28 | It will install the Neural Machine Translation application on your Android phone. 29 | -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/drawable/border.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/neural_machine_translation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NeuralMT - Powered by DJL 3 | Translate 4 | Running the model… 5 | Downloading the model… 6 | Error 7 | Failed to load model 8 | -------------------------------------------------------------------------------- /android/pytorch_android/neural_machine_translation/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/README.md: -------------------------------------------------------------------------------- 1 | # DoodleDraw recognition 2 | 3 | Rabbit | Cat | banana 4 | :-------------------------:|:-------------------------:|:-------------------------: 5 | ![](../img/rabbit.gif) | ![](../img/cat.gif) | ![](../img/banana.gif) 6 | 7 | [Quickdraw dataset](https://github.com/googlecreativelab/quickdraw-dataset) were created by Google 8 | that includes millions of hand-drawn doodle. The model were trained through 9 | the subset from [kaggle challenge](https://www.kaggle.com/c/quickdraw-doodle-recognition). 10 | 11 | Model were trained with MobileNet on PyTorch and achieved 91.7% top 3 accuracy. 12 | This application demos how user can import PyTorch model and run inference on their device. 13 | 14 | The minimum API level for this project is 26. 15 | 16 | ### Setup 17 | Use the following command to install this app on your Android phone: 18 | 19 | ``` 20 | cd quickdraw_recognition 21 | 22 | # for Linux/macOS 23 | ./gradlew iD 24 | 25 | # for Windows 26 | ..\gradlew iD 27 | ``` 28 | 29 | It will install the doodle_draw application on your Android phone. 30 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/java/ai/djl/examples/quickdraw/DoodleApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package ai.djl.examples.quickdraw; 14 | 15 | import android.app.Application; 16 | 17 | import java.io.File; 18 | 19 | public class DoodleApp extends Application { 20 | 21 | @Override 22 | public void onCreate() { 23 | super.onCreate(); 24 | File dir = getFilesDir(); 25 | System.setProperty("DJL_CACHE_DIR", dir.getAbsolutePath()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/drawable/border.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/quickdraw_recognition/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/values/dimes.xml: -------------------------------------------------------------------------------- 1 | 2 | 15sp 3 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DoodleDraw 3 | clear 4 | Image preview 5 | DoodleDraw - Powered by DJL 6 | Share 7 | 8 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/pytorch_android/quickdraw_recognition/src/main/res/xml/filepaths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/color/fab_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-hdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-hdpi/ic_camera.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-hdpi/ic_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-hdpi/ic_close.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-mdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-mdpi/ic_camera.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-mdpi/ic_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-mdpi/ic_close.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-xhdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-xhdpi/ic_camera.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-xhdpi/ic_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-xhdpi/ic_close.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-xxhdpi/ic_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-xxhdpi/ic_camera.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable-xxhdpi/ic_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/drawable-xxhdpi/ic_close.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable/ic_camera.xml: -------------------------------------------------------------------------------- 1 | 8 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/drawable/ic_close.xml: -------------------------------------------------------------------------------- 1 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/semantic_segmentation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #4DB6AC 6 | #80CBC4 7 | #009688 8 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 8dp 3 | 16dp 4 | 32dp 5 | 48dp 6 | 64dp 7 | 150dp 8 | 360dp 9 | 260dp 10 | 80dp 11 | 130dp 12 | 18sp 13 | 14 | -------------------------------------------------------------------------------- /android/pytorch_android/semantic_segmentation/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /android/pytorch_android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google { 4 | content { 5 | includeGroupByRegex("com\\.android.*") 6 | includeGroupByRegex("com\\.google.*") 7 | includeGroupByRegex("androidx.*") 8 | } 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | dependencyResolutionManagement { 15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 16 | repositories { 17 | google() 18 | mavenCentral() 19 | maven("https://central.sonatype.com/repository/maven-snapshots/") 20 | maven("https://oss.sonatype.org/service/local/repositories/${System.getenv("DJL_STAGING")}/content/") 21 | } 22 | } 23 | 24 | rootProject.name = "android" 25 | 26 | include(":face_detection") 27 | include(":neural_machine_translation") 28 | include(":quickdraw_recognition") 29 | include(":semantic_segmentation") 30 | include(":speech_recognition") 31 | include(":style_transfer_cyclegan") 32 | -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/README.md: -------------------------------------------------------------------------------- 1 | # Speech Recognition 2 | 3 | In this example, you will see how to do speech recognition with a pre-trained 4 | [wav2vec2](https://github.com/facebookresearch/fairseq/tree/main/examples/wav2vec) model. You 5 | will identify sounds and convert them to text. 6 | 7 | To use the app, press the Start button. It will listen to your audio for six seconds. When these 8 | six seconds are up, it will attempt to transcribe what you said into text. This app works best on 9 | a real Android phone. 10 | 11 | ![](https://djl-misc.s3.amazonaws.com/tmp/speech_recognition/ai/djl/pytorch/wav2vec2/speech.jpg) 12 | 13 | This model was trained on the [LibriSpeech](http://www.openslr.org/12) dataset. This demo 14 | shows how the model can perform inference on a user's device. 15 | 16 | ### Setup 17 | Use the following command to install this app on your Android phone: 18 | 19 | ``` 20 | cd speech_recognition 21 | 22 | # for Linux/macOS 23 | ./gradlew iD 24 | 25 | # for Windows 26 | ..\gradlew iD 27 | ``` 28 | 29 | It will install the Speech Recognition application on your Android phone. -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/speech_recognition/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18sp 4 | 5 | 6 | 16dp 7 | 48dp 8 | 280dp 9 | 10 | -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Speech Recognition - Powered by DJL 3 | Start 4 | Downloading the model 5 | Listening - %ds left 6 | Recognizing 7 | -------------------------------------------------------------------------------- /android/pytorch_android/speech_recognition/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/README.md: -------------------------------------------------------------------------------- 1 | # Style Transfer 2 | 3 | In this example, you will learn how to do style transfer with pre-trained CycleGAN models. 4 | You will transform regular images into a painting by a famous artist. The supported 5 | artists are: 6 | 7 | - Cezanne 8 | - Monet 9 | - Ukiyoe 10 | - Vangogh 11 | 12 | 13 | Cezanne | Monet      | Ukiyoe     | Vangogh 14 | :--------------:|:-----------------:|:----------------:|:--------------: 15 | ![](https://resources.djl.ai/images/cyclegan/cezanne.jpg?) | ![](https://resources.djl.ai/images/cyclegan/monet.jpg?) | ![](https://resources.djl.ai/images/cyclegan/ukiyoe.jpg?) | ![](https://resources.djl.ai/images/cyclegan/vangogh.jpg?) 16 | 17 | The minimum API level for this project is 26. 18 | 19 | ### Setup 20 | Use the following command to install this app on your Android phone: 21 | 22 | ``` 23 | cd style_transfer_cyclegan 24 | 25 | # for Linux/macOS 26 | ./gradlew iD 27 | 28 | # for Windows 29 | ..\gradlew iD 30 | ``` 31 | 32 | It will install the Style transfer application on your Android phone. 33 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/style_transfer_cyclegan/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Style Transfer 3 | -------------------------------------------------------------------------------- /android/pytorch_android/style_transfer_cyclegan/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /android/pytorch_android/web_hi_res_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/android/pytorch_android/web_hi_res_512.png -------------------------------------------------------------------------------- /apache-flink/image-classification/.gitignore: -------------------------------------------------------------------------------- 1 | asd.txt 2 | 3 | -------------------------------------------------------------------------------- /apache-flink/image-classification/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/apache-flink/image-classification/README.md -------------------------------------------------------------------------------- /apache-flink/image-classification/gradle: -------------------------------------------------------------------------------- 1 | ../../gradle -------------------------------------------------------------------------------- /apache-flink/image-classification/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /apache-flink/image-classification/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /apache-flink/image-classification/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat -------------------------------------------------------------------------------- /apache-flink/sentence_embedding/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | application 4 | } 5 | apply(file("../../tools/gradle/javaFormatter.gradle.kts")) 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | mavenCentral() 12 | mavenLocal() 13 | maven("https://central.sonatype.com/repository/maven-snapshots/") 14 | } 15 | 16 | dependencies { 17 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 18 | implementation("ai.djl:api") 19 | implementation("org.apache.flink:flink-streaming-java:${property("flint_version")}") 20 | 21 | runtimeOnly("org.apache.flink:flink-clients:${property("flint_version")}") 22 | runtimeOnly("ai.djl.pytorch:pytorch-engine") 23 | runtimeOnly("ai.djl.huggingface:tokenizers") 24 | runtimeOnly("org.slf4j:slf4j-simple:${property("slf4j_version")}") 25 | } 26 | 27 | tasks { 28 | application { 29 | mainClass = "com.example.SentenceEncoder" 30 | applicationDefaultJvmArgs = listOf( 31 | "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-Dorg.slf4j.simpleLogger.log.org.apache.flink=off" 32 | ) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apache-flink/sentence_embedding/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /apache-flink/sentence_embedding/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /apache-flink/sentiment-analysis/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | application 4 | } 5 | apply(file("../../tools/gradle/javaFormatter.gradle.kts")) 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | mavenCentral() 12 | mavenLocal() 13 | maven("https://central.sonatype.com/repository/maven-snapshots/") 14 | } 15 | 16 | dependencies { 17 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 18 | implementation("ai.djl:api") 19 | implementation("org.apache.flink:flink-streaming-java:${property("flint_version")}") 20 | 21 | runtimeOnly("org.apache.flink:flink-clients:${property("flint_version")}") 22 | runtimeOnly("ai.djl.pytorch:pytorch-model-zoo") 23 | runtimeOnly("org.slf4j:slf4j-simple:${property("slf4j_version")}") 24 | } 25 | 26 | tasks { 27 | application { 28 | mainClass = "com.example.SentimentAnalysis" 29 | applicationDefaultJvmArgs = listOf( 30 | "--add-opens", 31 | "java.base/java.lang=ALL-UNNAMED", 32 | "--add-opens", 33 | "java.base/java.util=ALL-UNNAMED", 34 | "-Dorg.slf4j.simpleLogger.log.org.apache.flink=off" 35 | ) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /apache-flink/sentiment-analysis/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /apache-flink/sentiment-analysis/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /apache-flink/sentiment-analysis/img/flink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/apache-flink/sentiment-analysis/img/flink.gif -------------------------------------------------------------------------------- /apache-kafka/.gitignore: -------------------------------------------------------------------------------- 1 | data.txt -------------------------------------------------------------------------------- /apache-kafka/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | application 4 | } 5 | apply(file("../tools/gradle/javaFormatter.gradle.kts")) 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | mavenCentral() 12 | mavenLocal() 13 | maven("https://central.sonatype.com/repository/maven-snapshots/") 14 | } 15 | 16 | dependencies { 17 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 18 | implementation("ai.djl:api") 19 | implementation("org.slf4j:slf4j-simple:${property("slf4j_version")}") 20 | implementation("org.apache.kafka:kafka-clients:${property("kafka_clients_version")}") 21 | 22 | runtimeOnly("ai.djl.pytorch:pytorch-model-zoo") 23 | } 24 | 25 | tasks { 26 | application { 27 | mainClass = "com.example.SentimentAnalysis" 28 | applicationDefaultJvmArgs = listOf( 29 | "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-Dorg.slf4j.simpleLogger.log.org.apache.kafka=off" 30 | ) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /apache-kafka/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /apache-kafka/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /apache-kafka/start_service.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | zookeeper-server-start /opt/homebrew/etc/kafka/zookeeper.properties & 6 | sleep 10 7 | kafka-server-start /opt/homebrew/etc/kafka/server.properties & 8 | sleep 5 9 | kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic twitter-data 10 | if [[ ! -f "data.txt" ]]; then 11 | curl -O https://resources.djl.ai/demo/kafka/data.txt 12 | fi 13 | kafka-console-producer --broker-list localhost:9092 --topic twitter-data ("deploy") { 27 | dependsOn("build") 28 | executable("./deploy.sh") 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/elasticbeanstalk-role.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2008-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Principal": { 7 | "Service": "ec2.amazonaws.com" 8 | }, 9 | "Action": "sts:AssumeRole" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/options.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Namespace": "aws:autoscaling:launchconfiguration", 4 | "OptionName": "IamInstanceProfile", 5 | "Value": "aws-elasticbeanstalk-ec2-role" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/src/main/java/com/example/doodle/DoodleApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.doodle; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DoodleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DoodleApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port : 5000 3 | -------------------------------------------------------------------------------- /aws/beanstalk-model-serving/src/main/resources/static/app.css: -------------------------------------------------------------------------------- 1 | #draw { 2 | width: 100%; 3 | overflow: hidden; 4 | } 5 | -------------------------------------------------------------------------------- /aws/emr-distributed-inference/dataprocess/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../gradle.properties -------------------------------------------------------------------------------- /aws/emr-distributed-inference/dataprocess/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /aws/emr-distributed-inference/dataprocess/img/configure emr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/aws/emr-distributed-inference/dataprocess/img/configure emr.gif -------------------------------------------------------------------------------- /aws/emr-distributed-inference/image-classification-gpu/configurations.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Classification":"spark", 4 | "Properties":{ 5 | "enableSparkRapids":"true" 6 | } 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /aws/emr-distributed-inference/image-classification-gpu/emr-prepare.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo rm /usr/local/cuda 4 | sudo ln -s /usr/local/cuda-10.1 /usr/local/cuda 5 | sudo mkdir /opt/sparkRapidsPlugin 6 | pushd /opt/sparkRapidsPlugin || exit 7 | sudo curl -O https://raw.githubusercontent.com/apache/spark/master/examples/src/main/scripts/getGpusResources.sh 8 | sudo chmod 777 getGpusResources.sh 9 | popd || exit 10 | -------------------------------------------------------------------------------- /aws/emr-distributed-inference/image-classification-gpu/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../gradle.properties -------------------------------------------------------------------------------- /aws/emr-distributed-inference/image-classification-gpu/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /aws/emr-distributed-inference/image-classification-gpu/install_rapid.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mkdir /opt/sparkRapidsPlugin 4 | pushd /opt/sparkRapidsPlugin || exit 5 | curl -O https://repo1.maven.org/maven2/com/nvidia/rapids-4-spark_2.12/0.2.0/rapids-4-spark_2.12-0.2.0.jar 6 | curl -O https://repo1.maven.org/maven2/ai/rapids/cudf/0.15/cudf-0.15-cuda10-1.jar 7 | curl -O https://raw.githubusercontent.com/apache/spark/master/examples/src/main/scripts/getGpusResources.sh 8 | chmod 777 getGpusResources.sh 9 | popd || exit 10 | -------------------------------------------------------------------------------- /aws/emr-distributed-inference/image-classification-gpu/install_spark.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl -O https://archive.apache.org/dist/spark/spark-3.0.1/spark-3.0.1-bin-hadoop2.7.tgz 4 | tar zxvf spark-3.0.1-bin-hadoop2.7.tgz 5 | mv spark-3.0.1-bin-hadoop2.7/ spark 6 | cp spark/conf/spark-env.sh.template spark/conf/spark-env.sh 7 | echo 'SPARK_WORKER_OPTS="-Dspark.worker.resource.gpu.amount=1 -Dspark.worker.resource.gpu.discoveryScript=/opt/sparkRapidsPlugin/getGpusResources.sh"' >> spark/conf/spark-env.sh 8 | -------------------------------------------------------------------------------- /aws/inferentia/gradle: -------------------------------------------------------------------------------- 1 | ../../gradle -------------------------------------------------------------------------------- /aws/inferentia/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /aws/inferentia/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /aws/inferentia/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat -------------------------------------------------------------------------------- /aws/inferentia/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /aws/lambda-model-serving/.gitignore: -------------------------------------------------------------------------------- 1 | bucket-name.txt 2 | out.yml 3 | output.json 4 | -------------------------------------------------------------------------------- /aws/lambda-model-serving/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | echo "Deploying lambda to AWS" 5 | 6 | if [ ! -f "bucket-name.txt" ]; then 7 | BUCKET_ID=$(dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n') 8 | BUCKET_NAME=djl-lambda-$BUCKET_ID 9 | echo "$BUCKET_NAME" >bucket-name.txt 10 | aws s3 mb s3://$BUCKET_NAME 11 | else 12 | BUCKET_NAME=$(cat bucket-name.txt) 13 | fi 14 | 15 | aws cloudformation package --template-file template.yml --s3-bucket $BUCKET_NAME --output-template-file out.yml 16 | aws cloudformation deploy --template-file out.yml --stack-name djl-lambda --capabilities CAPABILITY_NAMED_IAM 17 | -------------------------------------------------------------------------------- /aws/lambda-model-serving/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /aws/lambda-model-serving/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /aws/lambda-model-serving/src/test/java/com/examples/MockLogger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package com.examples; 14 | 15 | import com.amazonaws.services.lambda.runtime.LambdaLogger; 16 | 17 | import java.nio.charset.StandardCharsets; 18 | 19 | public class MockLogger implements LambdaLogger { 20 | 21 | @Override 22 | public void log(String message) { 23 | System.out.println(message); 24 | } 25 | 26 | @Override 27 | public void log(byte[] message) { 28 | System.out.println(new String(message, StandardCharsets.UTF_8)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /aws/lambda-model-serving/template.yml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: 'AWS::Serverless-2016-10-31' 3 | Description: An AWS Lambda application that calls the Lambda API. 4 | Resources: 5 | function: 6 | Type: AWS::Serverless::Function 7 | Properties: 8 | FunctionName: DJL-Lambda 9 | CodeUri: build/distributions/lambda-model-serving.zip 10 | Handler: com.examples.Handler 11 | Runtime: java8 12 | Description: DJL Lambda model serving 13 | MemorySize: 2048 14 | Timeout: 60 15 | # Function's execution role 16 | Policies: 17 | - AWSLambdaBasicExecutionRole 18 | - AWSLambdaReadOnlyAccess 19 | - AWSLambdaVPCAccessExecutionRole 20 | Tracing: Active 21 | -------------------------------------------------------------------------------- /aws/sagemaker/README.md: -------------------------------------------------------------------------------- 1 | # Use DJL with Amazon SageMaker 2 | 3 | Amazon SageMaker helps data scientists and developers to prepare, build, train, and deploy high-quality machine learning (ML) models quickly by bringing together a broad set of capabilities purpose-built for ML. DJL currently offers three integration support to SageMaker: 4 | 5 | - SageMaker Notebook: Simple setup to use Jupyter notebook 6 | - SageMaker Studio: Container solution for ML experiment 7 | - SageMaker Large Language Model Launch template 8 | - SageMaker Inference endpoint (coming soon): scalable and easy-to-use Java inference solution. 9 | 10 | To learn more, please go to the following instructions: 11 | 12 | [SageMaker Notebook](notebook/README.md) 13 | 14 | [SageMaker Studio](studio/README.md) 15 | 16 | [SageMaker LLM Launch template](large-model-inference/README.md) 17 | 18 | [SageMaker LLM instance recommendation](llm-instance-recommend/README.md) 19 | -------------------------------------------------------------------------------- /aws/sagemaker/large-model-inference/.gitignore: -------------------------------------------------------------------------------- 1 | **/*.ipynb_checkpoints -------------------------------------------------------------------------------- /aws/sagemaker/large-model-inference/sample-llm/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/aws/sagemaker/large-model-inference/sample-llm/utils/__init__.py -------------------------------------------------------------------------------- /aws/sagemaker/llm-instance-recommend/.gitignore: -------------------------------------------------------------------------------- 1 | lmi_recommender.egg-info -------------------------------------------------------------------------------- /aws/sagemaker/llm-instance-recommend/README.md: -------------------------------------------------------------------------------- 1 | # Inference Recommendation for Large Model Inference solution 2 | 3 | This package includes instance, configuration recommendation for large models using LMI containers. 4 | 5 | ## Installation 6 | 7 | To install this package, you can simply do 8 | 9 | ```bash 10 | pip install git+https://github.com/deepjavalibrary/djl-demo.git#subdirectory=aws/sagemaker/llm-instance-recommend 11 | ``` 12 | 13 | ## Usage 14 | 15 | You can provide a huggingface model id and get corresponding recommendations: 16 | 17 | ```python 18 | from lmi_recommender.instance_recommender import instance_recommendation 19 | from lmi_recommender.ir_strategy_maker import decision_maker, decision_pretty_print 20 | from lmi_recommender.lmi_config_recommender import lmi_config_recommender 21 | 22 | fp16_recommendation = instance_recommendation("OpenAssistant/llama2-13b-orca-8k-3319") 23 | lmi_config_recommender(fp16_recommendation) 24 | gpu_recommendation, neuron_recommendation = decision_maker(fp16_recommendation) 25 | decision_pretty_print(gpu_recommendation) 26 | ``` 27 | -------------------------------------------------------------------------------- /aws/sagemaker/llm-instance-recommend/lmi_recommender/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/aws/sagemaker/llm-instance-recommend/lmi_recommender/__init__.py -------------------------------------------------------------------------------- /aws/sagemaker/studio/image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/aws/sagemaker/studio/image.gif -------------------------------------------------------------------------------- /bom/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /bom/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /bom/settings.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/bom/settings.gradle.kts -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/build.gradle.kts -------------------------------------------------------------------------------- /camel-djl/src/main/java/one/entropy/demo/camel/djl/Demo.java: -------------------------------------------------------------------------------- 1 | package one.entropy.demo.camel.djl; 2 | 3 | import org.apache.camel.attachment.AttachmentMessage; 4 | import org.apache.camel.builder.endpoint.EndpointRouteBuilder; 5 | import org.apache.camel.main.Main; 6 | 7 | public class Demo extends EndpointRouteBuilder { 8 | 9 | public static void main(String[] args) throws Exception { 10 | Main main = new Main(); 11 | main.configure().addRoutesBuilder(Demo.class); 12 | main.run(); 13 | } 14 | 15 | public void configure() throws Exception { 16 | from(undertow("http://0.0.0.0:8080/upload")) 17 | .process(exchange -> 18 | exchange.getIn() 19 | .setBody(exchange.getIn(AttachmentMessage.class) 20 | .getAttachments().values().stream() 21 | .findFirst().get().getInputStream() 22 | .readAllBytes())) 23 | .to(djl("cv/image_classification") 24 | .artifactId("ai.djl.mxnet:mlp:0.0.2")) 25 | .marshal().json(true); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /camel-djl/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /camel-djl/src/test/resources/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/camel-djl/src/test/resources/10.png -------------------------------------------------------------------------------- /canary/gradle: -------------------------------------------------------------------------------- 1 | ../gradle -------------------------------------------------------------------------------- /canary/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /canary/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /canary/gradlew.bat: -------------------------------------------------------------------------------- 1 | ../gradlew.bat -------------------------------------------------------------------------------- /canary/src/main/java/ai/djl/canary/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | 14 | /** Contains examples of performing inference using pre-trained models. */ 15 | package ai.djl.canary; 16 | -------------------------------------------------------------------------------- /canary/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /development/fatjar/.gitignore: -------------------------------------------------------------------------------- 1 | /.bsp 2 | dependency-reduced-pom.xml 3 | -------------------------------------------------------------------------------- /development/fatjar/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 19 | -------------------------------------------------------------------------------- /development/fatjar/gradle: -------------------------------------------------------------------------------- 1 | ../../gradle -------------------------------------------------------------------------------- /development/fatjar/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /development/fatjar/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /development/fatjar/project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.6.2 2 | -------------------------------------------------------------------------------- /development/fatjar/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0") 2 | -------------------------------------------------------------------------------- /development/module/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /development/module/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /development/module/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module org.examples.module { 2 | exports org.examples.module; 3 | 4 | requires jdk.crypto.cryptoki; 5 | requires org.slf4j; 6 | requires org.apache.commons.compress; 7 | requires org.apache.commons.lang3; 8 | requires org.apache.logging.log4j; 9 | requires com.google.gson; 10 | requires com.sun.jna; 11 | requires ai.djl.api; 12 | requires ai.djl.pytorch_engine; 13 | requires ai.djl.pytorch_model_zoo; 14 | requires ai.djl.opencv; 15 | } 16 | -------------------------------------------------------------------------------- /development/module/src/main/java/org/examples/module/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | 14 | /** Contains examples of performing inference using pre-trained models. */ 15 | package org.examples.module; 16 | -------------------------------------------------------------------------------- /development/module/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /development/multi-engine/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNCHECKED_CAST") 2 | 3 | plugins { 4 | java 5 | application 6 | } 7 | apply(file("../../tools/gradle/javaFormatter.gradle.kts")) 8 | 9 | group = "com.example" 10 | version = "1.0-SNAPSHOT" 11 | 12 | repositories { 13 | mavenCentral() 14 | mavenLocal() 15 | maven("https://central.sonatype.com/repository/maven-snapshots/") 16 | } 17 | 18 | dependencies { 19 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 20 | implementation("ai.djl:api") 21 | 22 | runtimeOnly("ai.djl.pytorch:pytorch-model-zoo") 23 | runtimeOnly("ai.djl.mxnet:mxnet-model-zoo") 24 | 25 | implementation("org.slf4j:slf4j-simple:${property("slf4j_version")}") 26 | } 27 | 28 | tasks { 29 | application { 30 | mainClass = "com.examples.MultiEngine" 31 | } 32 | 33 | run.configure { 34 | systemProperties = System.getProperties().toMap() as Map 35 | systemProperties.remove("user.dir") 36 | } 37 | 38 | distTar { enabled = false } 39 | } 40 | -------------------------------------------------------------------------------- /development/multi-engine/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /development/multi-engine/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /development/multi-engine/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /development/multi-engine/src/test/resources/joints.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/development/multi-engine/src/test/resources/joints.png -------------------------------------------------------------------------------- /development/multi-engine/src/test/resources/pose_soccer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/development/multi-engine/src/test/resources/pose_soccer.png -------------------------------------------------------------------------------- /development/python/gradle: -------------------------------------------------------------------------------- 1 | ../../gradle -------------------------------------------------------------------------------- /development/python/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /development/python/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /development/python/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat -------------------------------------------------------------------------------- /development/python/src/test/resources/resnet18/requirements.txt: -------------------------------------------------------------------------------- 1 | torchvision 2 | -------------------------------------------------------------------------------- /djl-serving/binary-mode/inference.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import urllib3 3 | import io 4 | 5 | http = urllib3.PoolManager() 6 | 7 | data = np.zeros((1, 3, 224, 224), dtype=np.float32) 8 | 9 | memory_file = io.BytesIO() 10 | np.savez(memory_file, data) 11 | memory_file.seek(0) 12 | 13 | response = http.request( 14 | 'POST', 15 | 'http://localhost:8080/predictions/resnet', 16 | headers={'Content-Type': 'tensor/npz', "Accept": "tensor/npz"}, 17 | body=memory_file.read() 18 | ) 19 | 20 | print(f"Response content-Type: {response.headers['content-type']}") 21 | list = np.load(io.BytesIO(response.data)) 22 | output = list["arr_0"] 23 | print(f"Output shape: {output.shape}") 24 | -------------------------------------------------------------------------------- /djl-serving/java-client/.gitignore: -------------------------------------------------------------------------------- 1 | kitten.jpg 2 | -------------------------------------------------------------------------------- /djl-serving/java-client/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | application 4 | } 5 | apply(file("../../tools/gradle/javaFormatter.gradle.kts")) 6 | 7 | group = "org.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | mavenCentral() 12 | mavenLocal() 13 | maven("https://central.sonatype.com/repository/maven-snapshots/") 14 | } 15 | 16 | dependencies { 17 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 18 | implementation("ai.djl:api") 19 | implementation("ai.djl.pytorch:pytorch-engine") 20 | } 21 | 22 | tasks { 23 | application { 24 | mainClass = "ai.djl.examples.serving.javaclient.DJLServingClientExample1" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /djl-serving/java-client/gradle: -------------------------------------------------------------------------------- 1 | ../../gradle -------------------------------------------------------------------------------- /djl-serving/java-client/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.jvmargs=-Xmx1024M --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ 3 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ 4 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ 5 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ 6 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 7 | 8 | systemProp.org.gradle.internal.http.socketTimeout=120000 9 | systemProp.org.gradle.internal.http.connectionTimeout=60000 10 | 11 | # FIXME: Workaround gradle publish issue: https://github.com/gradle/gradle/issues/11308 12 | systemProp.org.gradle.internal.publish.checksums.insecure=true 13 | 14 | djl_version=0.25.0 15 | commons_cli_version=1.5.0 16 | log4j_slf4j_version=2.19.0 17 | slf4j_simple_version=1.7.36 18 | rapis_version=22.12.0 19 | testng_version=7.7.1 20 | -------------------------------------------------------------------------------- /djl-serving/java-client/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /djl-serving/java-client/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat -------------------------------------------------------------------------------- /djl-serving/java-mode/devEnv/.gitignore: -------------------------------------------------------------------------------- 1 | resnet18 2 | -------------------------------------------------------------------------------- /djl-serving/java-mode/devEnv/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | apply(file("../../../tools/gradle/javaFormatter.gradle.kts")) 5 | 6 | group = "org.example" 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | mavenCentral() 11 | mavenLocal() 12 | maven("https://central.sonatype.com/repository/maven-snapshots/") 13 | } 14 | 15 | val exclusion by configurations.registering 16 | 17 | @Suppress("UnstableApiUsage") 18 | dependencies { 19 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 20 | implementation("ai.djl:api") 21 | exclusion("ai.djl:api:${property("djl_version")}") 22 | } 23 | 24 | tasks { 25 | jar { 26 | from((configurations.compileClasspath.get() - exclusion.get()).map { 27 | if (it.isDirectory()) it else zipTree(it) 28 | }) 29 | duplicatesStrategy = DuplicatesStrategy.WARN 30 | } 31 | 32 | test { 33 | useJUnitPlatform() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /djl-serving/java-mode/devEnv/gradle: -------------------------------------------------------------------------------- 1 | ../../../gradle -------------------------------------------------------------------------------- /djl-serving/java-mode/devEnv/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../gradle.properties -------------------------------------------------------------------------------- /djl-serving/java-mode/devEnv/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /djl-serving/java-mode/devEnv/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /djl-serving/multi-node/eks-cluster.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: eksctl.io/v1alpha5 2 | kind: ClusterConfig 3 | 4 | metadata: 5 | name: multi-node-cluster-p4de 6 | region: us-west-2 7 | version: "1.30" 8 | 9 | iam: 10 | withOIDC: true 11 | 12 | availabilityZones: ["us-west-2a","us-west-2c","us-west-2b"] 13 | 14 | managedNodeGroups: 15 | - name: efa-ng 16 | instanceType: p4de.24xlarge 17 | minSize: 2 18 | desiredCapacity: 2 19 | maxSize: 2 20 | availabilityZones: ["us-west-2a"] 21 | volumeSize: 1200 22 | privateNetworking: true 23 | efaEnabled: true # remove if not using EFA-enabled instances 24 | iam: 25 | instanceRolearn: "arn:aws:iam::125045733377:role/ec2-admin-role" 26 | ssh: 27 | allow: true 28 | publicKeyName: "multinode" 29 | capacityReservation: 30 | capacityReservationTarget: 31 | capacityReservationID: "cr-0468e11ba77bbc5de" 32 | # below optional 33 | kubernetesNetworkConfig: 34 | ipFamily: IPv4 35 | serviceIPv4CIDR: 172.21.0.0/16 36 | -------------------------------------------------------------------------------- /djl-serving/multi-node/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: lmi-leader 5 | spec: 6 | ports: 7 | - name: http 8 | port: 8080 9 | protocol: TCP 10 | targetPort: 8080 11 | selector: 12 | leaderworkerset.sigs.k8s.io/name: lmi 13 | role: leader 14 | type: ClusterIP 15 | -------------------------------------------------------------------------------- /djl-serving/python-client/.gitignore: -------------------------------------------------------------------------------- 1 | kitten.jpg -------------------------------------------------------------------------------- /djl-serving/python-mode/resnet18/requirements.txt: -------------------------------------------------------------------------------- 1 | torchvision==0.12.0 -------------------------------------------------------------------------------- /djl-serving/python-mode/stable-diffusion/docs/img/img2img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/djl-serving/python-mode/stable-diffusion/docs/img/img2img.png -------------------------------------------------------------------------------- /djl-serving/python-mode/stable-diffusion/docs/img/inference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/djl-serving/python-mode/stable-diffusion/docs/img/inference.png -------------------------------------------------------------------------------- /djl-serving/python-mode/stable-diffusion/docs/img/model-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/djl-serving/python-mode/stable-diffusion/docs/img/model-list.png -------------------------------------------------------------------------------- /djl-serving/python-mode/stable-diffusion/docs/img/text2text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/djl-serving/python-mode/stable-diffusion/docs/img/text2text.png -------------------------------------------------------------------------------- /djl-serving/python-mode/stable-diffusion/requirements.txt: -------------------------------------------------------------------------------- 1 | transformers 2 | diffusers 3 | -------------------------------------------------------------------------------- /djl-serving/python-mode/zero-shot-image-classification/requirements.txt: -------------------------------------------------------------------------------- 1 | PIL -------------------------------------------------------------------------------- /djl-serving/wlm/flink-sentiment-analysis/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../gradle.properties -------------------------------------------------------------------------------- /djl-serving/wlm/flink-sentiment-analysis/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /djl-serving/workflows/java-pre-post-processing/function/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | apply(file("../../../../tools/gradle/javaFormatter.gradle.kts")) 5 | 6 | group = "org.example" 7 | version = "1.0-SNAPSHOT" 8 | // var djlVersion = property("djl_version") as String 9 | // djlVersion = if (djlVersion.endsWith("-SNAPSHOT")) djlVersion else "${djlVersion}-SNAPSHOT" 10 | 11 | repositories { 12 | mavenCentral() 13 | mavenLocal() 14 | maven("https://central.sonatype.com/repository/maven-snapshots/") 15 | } 16 | 17 | dependencies { 18 | implementation(platform("ai.djl:bom:0.28.0")) 19 | implementation("ai.djl:api") 20 | implementation("ai.djl.serving:serving") 21 | } 22 | -------------------------------------------------------------------------------- /djl-serving/workflows/java-pre-post-processing/function/gradle: -------------------------------------------------------------------------------- 1 | ../../../../gradle -------------------------------------------------------------------------------- /djl-serving/workflows/java-pre-post-processing/function/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../../gradle.properties -------------------------------------------------------------------------------- /djl-serving/workflows/java-pre-post-processing/function/gradlew: -------------------------------------------------------------------------------- 1 | ../../../../gradlew -------------------------------------------------------------------------------- /djl-serving/workflows/java-pre-post-processing/function/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /djl-serving/workflows/java-pre-post-processing/workflow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resnet18", 3 | "version": "0.1", 4 | "models": { 5 | "model": "djl://ai.djl.pytorch/resnet?translatorFactory=ai.djl.translate.NoopServingTranslatorFactory" 6 | }, 7 | "functions": { 8 | "preprocess": "org.example.PreprocessWF", 9 | "postprocess": "org.example.PostprocessWF" 10 | }, 11 | "workflow": { 12 | "preprocessed": ["preprocess", "in"], 13 | "inferenced": ["model", "preprocessed"], 14 | "out": ["postprocess", "inferenced"] 15 | } 16 | } -------------------------------------------------------------------------------- /djl-serving/workflows/multi-model/function/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | apply(file("../../../../tools/gradle/javaFormatter.gradle.kts")) 5 | 6 | group = "org.example" 7 | version = "1.0-SNAPSHOT" 8 | // var djlVersion = property("djl_version") as String 9 | // djlVersion = if (djlVersion.endsWith("-SNAPSHOT")) djlVersion else "${djlVersion}-SNAPSHOT" 10 | 11 | repositories { 12 | mavenCentral() 13 | mavenLocal() 14 | maven("https://central.sonatype.com/repository/maven-snapshots/") 15 | } 16 | 17 | dependencies { 18 | implementation(platform("ai.djl:bom:0.28.0")) 19 | implementation("ai.djl:api") 20 | implementation("ai.djl.serving:serving") 21 | } 22 | -------------------------------------------------------------------------------- /djl-serving/workflows/multi-model/function/gradle: -------------------------------------------------------------------------------- 1 | ../../../../gradle -------------------------------------------------------------------------------- /djl-serving/workflows/multi-model/function/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../../gradle.properties -------------------------------------------------------------------------------- /djl-serving/workflows/multi-model/function/gradlew: -------------------------------------------------------------------------------- 1 | ../../../../gradlew -------------------------------------------------------------------------------- /djl-serving/workflows/multi-model/function/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\..\..\gradlew.bat 2 | -------------------------------------------------------------------------------- /djl-serving/workflows/multi-model/workflow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multi-model", 3 | "version": "0.1", 4 | "models": { 5 | "objectDetection": { 6 | "application": "cv/object_detection", 7 | "modelUrl": "djl://ai.djl.mxnet/ssd", 8 | "filters": { 9 | "backbone": "resnet50" 10 | } 11 | }, 12 | "poseEstimation": { 13 | "application": "cv/pose_estimation", 14 | "modelUrl": "djl://ai.djl.mxnet/simple_pose", 15 | "filters": { 16 | "backbone": "resnet18", 17 | "dataset": "imagenet" 18 | } 19 | } 20 | }, 21 | "functions": { 22 | "extractPerson": "org.example.ExtractPersonWF" 23 | }, 24 | "workflow": { 25 | "detectedObjects": ["objectDetection", "in"], 26 | "person": ["extractPerson", "in", "detectedObjects"], 27 | "out": ["poseEstimation", "person"] 28 | } 29 | } -------------------------------------------------------------------------------- /djl-serving/workflows/python-pre-post-processing/postprocess/requirements.txt: -------------------------------------------------------------------------------- 1 | torch -------------------------------------------------------------------------------- /djl-serving/workflows/python-pre-post-processing/preprocess/requirements.txt: -------------------------------------------------------------------------------- 1 | torch 2 | torchvision -------------------------------------------------------------------------------- /djl-serving/workflows/python-pre-post-processing/workflow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resnet18", 3 | "version": "0.1", 4 | "models": { 5 | "preprocess": "preprocess/", 6 | "model": "djl://ai.djl.pytorch/resnet?translatorFactory=ai.djl.translate.NoopServingTranslatorFactory", 7 | "postprocess": "postprocess/" 8 | }, 9 | "workflow": { 10 | "preprocessed": ["preprocess", "in"], 11 | "inferenced": ["model", "preprocessed"], 12 | "out": ["postprocess", "inferenced"] 13 | } 14 | } -------------------------------------------------------------------------------- /djl-serving/workflows/python/resnet18/requirements.txt: -------------------------------------------------------------------------------- 1 | torchvision==0.12.0 -------------------------------------------------------------------------------- /djl-serving/workflows/python/workflow.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resnet18", 3 | "version": "0.1", 4 | "models": { 5 | "model": "resnet18/" 6 | }, 7 | "workflow": { 8 | "out": ["model", "in"] 9 | } 10 | } -------------------------------------------------------------------------------- /footwear_classification/.gitignore: -------------------------------------------------------------------------------- 1 | ut-zap50k-images-square* 2 | models 3 | -------------------------------------------------------------------------------- /footwear_classification/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /footwear_classification/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /genai/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNCHECKED_CAST") 2 | 3 | plugins { 4 | application 5 | } 6 | apply(file("../tools/gradle/javaFormatter.gradle.kts")) 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | mavenCentral() 13 | mavenLocal() 14 | maven("https://central.sonatype.com/repository/maven-snapshots/") 15 | } 16 | 17 | dependencies { 18 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 19 | implementation("ai.djl:api") 20 | implementation("ai.djl.genai:genai") 21 | 22 | implementation("org.slf4j:slf4j-simple:${property("slf4j_version")}") 23 | } 24 | 25 | tasks { 26 | application { 27 | mainClass = "org.example.ChatCompletion" 28 | } 29 | 30 | compileJava { 31 | options.compilerArgs = listOf("-parameters") 32 | } 33 | 34 | run.configure { 35 | systemProperties = System.getProperties().toMap() as Map 36 | systemProperties.remove("user.dir") 37 | systemProperty("file.encoding", "UTF-8") 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /genai/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /graalvm/.mvn/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | maven-wrapper.jar 2 | 3 | -------------------------------------------------------------------------------- /graalvm/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /gradle/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | GradleWrapperDownloader.class -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jan 16 22:46:13 PST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip 7 | -------------------------------------------------------------------------------- /huggingface/.gitignore: -------------------------------------------------------------------------------- 1 | special_tokens_map.json 2 | tokenizer.json 3 | tokenizer_config.json 4 | vocab.txt 5 | -------------------------------------------------------------------------------- /huggingface/hybrid/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNCHECKED_CAST") 2 | 3 | plugins { 4 | java 5 | application 6 | } 7 | apply(file("../../tools/gradle/javaFormatter.gradle.kts")) 8 | 9 | group = "com.example" 10 | version = "1.0-SNAPSHOT" 11 | var djlVersion = property("djl_version") as String 12 | 13 | repositories { 14 | mavenCentral() 15 | mavenLocal() 16 | maven("https://central.sonatype.com/repository/maven-snapshots/") 17 | } 18 | 19 | dependencies { 20 | implementation(platform("ai.djl:bom:${djlVersion}")) 21 | implementation("ai.djl:api") 22 | 23 | runtimeOnly("ai.djl.pytorch:pytorch-model-zoo") 24 | runtimeOnly("ai.djl.python:python") 25 | 26 | runtimeOnly("org.apache.logging.log4j:log4j-slf4j2-impl:${property("log4j_slf4j_version")}") 27 | } 28 | 29 | tasks { 30 | application { 31 | mainClass = "com.examples.HybridPythonEngine" 32 | } 33 | 34 | run.configure { 35 | systemProperties = System.getProperties().toMap() as Map 36 | systemProperties.remove("user.dir") 37 | } 38 | 39 | distTar { enabled = false } 40 | } 41 | -------------------------------------------------------------------------------- /huggingface/hybrid/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /huggingface/hybrid/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /huggingface/hybrid/models/example_inputs/question_answering.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "How is the weather", 3 | "paragraph": "The weather is nice, it is beautiful day" 4 | } 5 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/example_inputs/text_classification.txt: -------------------------------------------------------------------------------- 1 | Bloomberg has decided to publish a new report on the global economy. 2 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/example_inputs/token_classification.txt: -------------------------------------------------------------------------------- 1 | Bloomberg has decided to publish a new report on the global economy. 2 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/hybrid/question_answering_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "model_name": "distilbert-base-uncased-distilled-squad", 3 | "do_lower_case": true, 4 | "max_length": "128" 5 | } 6 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/hybrid/text_classification_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "model_name": "bert-base-uncased", 3 | "do_lower_case": true, 4 | "num_labels": "2", 5 | "max_length": "150" 6 | } 7 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/hybrid/text_classification_labels.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": "Not Accepted", 3 | "1": "Accepted" 4 | } 5 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/hybrid/token_classification_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "model_name": "bert-base-uncased", 3 | "do_lower_case": true, 4 | "num_labels": "9", 5 | "max_length": "150" 6 | } 7 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/hybrid/token_classification_labels.json: -------------------------------------------------------------------------------- 1 | { 2 | "label_list": "[O, B-MISC, I-MISC, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC]" 3 | } 4 | -------------------------------------------------------------------------------- /huggingface/hybrid/models/requirements.txt: -------------------------------------------------------------------------------- 1 | torch 2 | transformers 3 | -------------------------------------------------------------------------------- /huggingface/hybrid/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /huggingface/inferentia/.gitignore: -------------------------------------------------------------------------------- 1 | qa_payload.json 2 | -------------------------------------------------------------------------------- /huggingface/inferentia/SageMaker-Role-Policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Principal": { 7 | "Service": "sagemaker.amazonaws.com" 8 | }, 9 | "Action": "sts:AssumeRole" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /huggingface/inferentia/question_answering/requirements.txt: -------------------------------------------------------------------------------- 1 | transformers 2 | -------------------------------------------------------------------------------- /huggingface/inferentia/question_answering/serving.properties: -------------------------------------------------------------------------------- 1 | translatorFactory=ai.djl.pytorch.zoo.nlp.qa.PtBertQATranslatorFactory 2 | engine=PyTorch 3 | tokenizer=distilbert 4 | padding=true 5 | max_length=128 6 | -------------------------------------------------------------------------------- /huggingface/inferentia/requirements.txt: -------------------------------------------------------------------------------- 1 | --extra-index-url=https://pip.repos.neuron.amazonaws.com 2 | transformers 3 | torch-neuron==1.12.1.* 4 | neuron-cc[tensorflow] 5 | -------------------------------------------------------------------------------- /huggingface/nlp/gradle: -------------------------------------------------------------------------------- 1 | ../../gradle -------------------------------------------------------------------------------- /huggingface/nlp/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /huggingface/nlp/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /huggingface/nlp/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\..\gradlew.bat -------------------------------------------------------------------------------- /huggingface/python/example_inputs/question_answering.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "How is the weather", 3 | "paragraph": "The weather is nice, it is beautiful day" 4 | } 5 | -------------------------------------------------------------------------------- /huggingface/python/example_inputs/text_classification.txt: -------------------------------------------------------------------------------- 1 | Bloomberg has decided to publish a new report on the global economy. 2 | -------------------------------------------------------------------------------- /huggingface/python/example_inputs/token_classification.txt: -------------------------------------------------------------------------------- 1 | Bloomberg has decided to publish a new report on the global economy. 2 | -------------------------------------------------------------------------------- /huggingface/python/question_answering/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "model_name": "distilbert-base-uncased-distilled-squad", 3 | "do_lower_case": true, 4 | "max_length": "128" 5 | } 6 | -------------------------------------------------------------------------------- /huggingface/python/requirements.txt: -------------------------------------------------------------------------------- 1 | torch 2 | transformers 3 | -------------------------------------------------------------------------------- /huggingface/python/text_classification/labels.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": "Not Accepted", 3 | "1": "Accepted" 4 | } 5 | -------------------------------------------------------------------------------- /huggingface/python/text_classification/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "model_name": "bert-base-uncased", 3 | "do_lower_case": true, 4 | "num_labels": "2", 5 | "max_length": "150" 6 | } 7 | -------------------------------------------------------------------------------- /huggingface/python/token_classification/labels.json: -------------------------------------------------------------------------------- 1 | { 2 | "label_list": "[O, B-MISC, I-MISC, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC]" 3 | } 4 | -------------------------------------------------------------------------------- /huggingface/python/token_classification/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "model_name": "bert-base-uncased", 3 | "do_lower_case": true, 4 | "num_labels": "9", 5 | "max_length": "150" 6 | } 7 | -------------------------------------------------------------------------------- /jupyter/.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints/ 2 | -------------------------------------------------------------------------------- /jupyter/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 2 | 3 | RUN apt-get update || true \ 4 | && apt-get install -y openjdk-17-jdk-headless python3-pip git git-lfs curl locales \ 5 | && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ 6 | && dpkg-reconfigure --frontend=noninteractive locales \ 7 | && update-locale LANG=en_US.UTF-8 \ 8 | && apt-get clean -y \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | RUN rm /usr/lib/python*/EXTERNALLY-MANAGED \ 12 | && pip3 install jupyter \ 13 | && pip3 cache purge 14 | 15 | RUN git clone https://github.com/frankfliu/IJava.git \ 16 | && cd IJava/ && ./gradlew installKernel && cd .. && rm -rf IJava/ \ 17 | && rm -rf ~/.gradle 18 | 19 | WORKDIR /home/jupyter 20 | 21 | ENV LANG en_US.UTF-8 22 | ENV LC_ALL en_US.UTF-8 23 | 24 | EXPOSE 8888 25 | 26 | ENTRYPOINT ["jupyter", "notebook", "--ip=0.0.0.0", "--no-browser", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password=''"] 27 | -------------------------------------------------------------------------------- /jupyter/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | 5 | var File.text 6 | get() = readText() 7 | set(value) = writeText(value) 8 | 9 | tasks { 10 | register("increaseDjlVersion") { 11 | doLast { 12 | val djlVersion = project.property("djl_version").toString() 13 | val versions = djlVersion.split(Regex("\\.")).toMutableList(); 14 | versions[1] = (Integer.parseInt(versions[1]) - 1).toString() 15 | val previousVersion = versions.joinToString(".") 16 | val collection = fileTree(projectDir).filter { it.name.endsWith(".ipynb") } 17 | 18 | println("Upgrading to $djlVersion ...") 19 | for (file in collection) { 20 | file.text = file.text.replace(Regex("/${previousVersion}/"), "/${djlVersion}/") 21 | .replace(">${previousVersion}<", ">${djlVersion}<") 22 | .replace("'${previousVersion}'", "'${djlVersion}'") 23 | .replace("-${previousVersion}", "-${djlVersion}") 24 | .replace("_${previousVersion}", "_${djlVersion}") 25 | .replace(Regex(":${previousVersion}([\"\\\\\\n])"), ":${djlVersion}\$1") 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /jupyter/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2.4" 2 | services: 3 | deepjavalibrary_container: 4 | build: 5 | context: . 6 | dockerfile: Dockerfile 7 | ports: 8 | - 8888:8888 9 | volumes: 10 | - ./:/home/jupyter 11 | restart: always 12 | 13 | -------------------------------------------------------------------------------- /jupyter/gradle: -------------------------------------------------------------------------------- 1 | ../gradle -------------------------------------------------------------------------------- /jupyter/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /jupyter/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /jupyter/test_notebook.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # test_notebook.sh [filename] 4 | # If no filename is passed, it runs all files in current directory and subdirectories 5 | 6 | set -e 7 | 8 | function run_test { 9 | base=$(basename $1) 10 | # Workaround on crashes 11 | if [[ "$base" == transfer_learning_on_cifar10* || "$base" == rank_classification_using_BERT* ]]; then 12 | jupyter nbconvert --to notebook --inplace $1 13 | else 14 | jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=600 --inplace $1 15 | fi 16 | } 17 | 18 | if [[ $# -eq 0 ]]; then 19 | for f in {**,.}/*.ipynb 20 | do 21 | dir=$(dirname f) 22 | run_test "$f" 23 | done 24 | else 25 | run_test $1 26 | fi 27 | -------------------------------------------------------------------------------- /jupyter/tutorial/README.md: -------------------------------------------------------------------------------- 1 | # DJL - Beginner Tutorial 2 | 3 | Our beginner tutorial takes you through creating your first network, training it, and using it in a real system. This is a good place to start if you are new to DJL or to deep learning. 4 | 5 | 1. [Create your first neural network](01_create_your_first_network.ipynb) 6 | 2. [Train your first model](02_train_your_first_model.ipynb) 7 | 3. [Run image classification with your first model](03_image_classification_with_your_model.ipynb) 8 | -------------------------------------------------------------------------------- /live-object-detection/README.md: -------------------------------------------------------------------------------- 1 | # Live Object Detection 2 | 3 | This is an example to demonstrate how to use DJL for live object detection from web camera. 4 | 5 | ## Setup 6 | 7 | To configure your development environment, follow [setup](https://github.com/deepjavalibrary/djl/blob/master/docs/development/setup.md#setup-development-environment). 8 | 9 | ## Build the project and run 10 | Use the following command to run the project: 11 | ``` 12 | cd live-object-detection 13 | 14 | # Linux/macOS/Windows gitbash: 15 | ./gradlew run 16 | 17 | # Windows command prompty: 18 | ..\gradlew run 19 | ``` 20 | -------------------------------------------------------------------------------- /live-object-detection/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | application 4 | } 5 | apply(file("../tools/gradle/javaFormatter.gradle.kts")) 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | mavenCentral() 12 | mavenLocal() 13 | maven("https://central.sonatype.com/repository/maven-snapshots/") 14 | } 15 | 16 | dependencies { 17 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 18 | implementation("ai.djl.pytorch:pytorch-model-zoo") 19 | implementation("ai.djl.opencv:opencv") 20 | 21 | runtimeOnly("org.slf4j:slf4j-simple:${property("slf4j_version")}") 22 | } 23 | 24 | tasks { 25 | application { 26 | mainClass = "com.examples.WebCam" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /live-object-detection/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /live-object-detection/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /live-object-detection/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\gradlew.bat 2 | -------------------------------------------------------------------------------- /malicious-url-detector/docs/convolutional_layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/malicious-url-detector/docs/convolutional_layers.png -------------------------------------------------------------------------------- /malicious-url-detector/docs/correct_firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/malicious-url-detector/docs/correct_firefox.png -------------------------------------------------------------------------------- /malicious-url-detector/docs/dense_layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/malicious-url-detector/docs/dense_layer.png -------------------------------------------------------------------------------- /malicious-url-detector/docs/proxy_firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/malicious-url-detector/docs/proxy_firefox.png -------------------------------------------------------------------------------- /malicious-url-detector/docs/wrong_url_firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/malicious-url-detector/docs/wrong_url_firefox.png -------------------------------------------------------------------------------- /malicious-url-detector/gradle: -------------------------------------------------------------------------------- 1 | ../gradle -------------------------------------------------------------------------------- /malicious-url-detector/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /malicious-url-detector/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /malicious-url-detector/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\gradlew.bat 2 | -------------------------------------------------------------------------------- /pneumonia-detection/.gitignore: -------------------------------------------------------------------------------- 1 | models/ 2 | -------------------------------------------------------------------------------- /pneumonia-detection/build.gradle.kts: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNCHECKED_CAST") 2 | 3 | plugins { 4 | java 5 | application 6 | } 7 | apply(file("../tools/gradle/javaFormatter.gradle.kts")) 8 | 9 | group = "com.example" 10 | version = "1.0-SNAPSHOT" 11 | 12 | repositories { 13 | mavenCentral() 14 | mavenLocal() 15 | maven("https://central.sonatype.com/repository/maven-snapshots/") 16 | } 17 | 18 | dependencies { 19 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 20 | implementation("ai.djl:api") 21 | 22 | runtimeOnly("ai.djl.tensorflow:tensorflow-engine") 23 | runtimeOnly("org.slf4j:slf4j-simple:${property("slf4j_version")}") 24 | } 25 | 26 | tasks { 27 | application { 28 | mainClass = "com.examples.PneumoniaDetection" 29 | } 30 | 31 | run.configure { 32 | environment("TF_CPP_MIN_LOG_LEVEL", "1") // turn off TensorFlow print out 33 | systemProperties = System.getProperties().toMap() as Map 34 | systemProperties.remove("user.dir") 35 | systemProperty("file.encoding", "UTF-8") 36 | } 37 | 38 | distTar { 39 | enabled = false 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /pneumonia-detection/gradle: -------------------------------------------------------------------------------- 1 | ../gradle -------------------------------------------------------------------------------- /pneumonia-detection/gradle.properties: -------------------------------------------------------------------------------- 1 | ../gradle.properties -------------------------------------------------------------------------------- /pneumonia-detection/gradlew: -------------------------------------------------------------------------------- 1 | ../gradlew -------------------------------------------------------------------------------- /pneumonia-detection/gradlew.bat: -------------------------------------------------------------------------------- 1 | call ..\gradlew.bat 2 | -------------------------------------------------------------------------------- /quarkus/example/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* -------------------------------------------------------------------------------- /quarkus/example/.mvn/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | maven-wrapper.jar 2 | 3 | -------------------------------------------------------------------------------- /quarkus/example/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /quarkus/example/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the docker image run: 5 | # 6 | # mvn package -Pnative -Dquarkus.native.container-build=true 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/pneumonia-detection-quarkus . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/pneumonia-detection-quarkus 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 18 | WORKDIR /work/ 19 | COPY --chown=1001:root target/*-runner /work/application 20 | 21 | EXPOSE 8080 22 | USER 1001 23 | 24 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] -------------------------------------------------------------------------------- /quarkus/example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.native.enable-jni=true 2 | # quarkus.ssl.native=false 3 | 4 | quarkus.native.additional-build-args=--verbose,--enable-https,\ 5 | -H:+TraceClassInitialization,\ 6 | --report-unsupported-elements-at-runtime,\ 7 | --initialize-at-run-time=io.netty.internal.tcnative.SSL,\ 8 | --initialize-at-run-time=ai.djl\\,org.bytedeco\\,org.tensorflow\\,com.google.protobuf 9 | 10 | quarkus.log.category."ai.djl".level=DEBUG 11 | quarkus.log.category."com.example".level=DEBUG 12 | -------------------------------------------------------------------------------- /quarkus/example/src/test/java/com/example/ImageClassificationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package com.example; 14 | 15 | import io.quarkus.test.junit.QuarkusTest; 16 | import io.restassured.RestAssured; 17 | import org.junit.jupiter.api.Test; 18 | 19 | @QuarkusTest 20 | public class ImageClassificationTest { 21 | 22 | @Test 23 | public void testHelloEndpoint() { 24 | RestAssured.given().when().get("/detect").then().statusCode(200); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /quarkus/extension-example/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* -------------------------------------------------------------------------------- /quarkus/extension-example/.mvn/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | maven-wrapper.jar 2 | 3 | -------------------------------------------------------------------------------- /quarkus/extension-example/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /quarkus/extension-example/.s2i/environment: -------------------------------------------------------------------------------- 1 | MAVEN_S2I_ARTIFACT_DIRS=target 2 | S2I_SOURCE_DEPLOYMENTS_FILTER=*-runner.jar lib 3 | JAVA_OPTIONS=-Dquarkus.http.host=0.0.0.0 4 | AB_JOLOKIA_OFF=true 5 | -------------------------------------------------------------------------------- /quarkus/extension-example/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the docker image run: 5 | # 6 | # mvn package -Pnative -Dquarkus.native.container-build=true 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/getting-started . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/getting-started 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal 18 | WORKDIR /work/ 19 | COPY target/*-runner /work/application 20 | RUN chmod 775 /work 21 | EXPOSE 8080 22 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 23 | -------------------------------------------------------------------------------- /quarkus/extension-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Quarkus Configuration file 2 | # key = value 3 | quarkus.djl-model.input-class=ai.djl.modality.cv.Image 4 | quarkus.djl-model.output-class=ai.djl.modality.Classifications 5 | -------------------------------------------------------------------------------- /quarkus/extension/deployment/src/main/java/ai/djl/quarkus/deployment/DjlModelBuildItem.java: -------------------------------------------------------------------------------- 1 | package ai.djl.quarkus.deployment; 2 | 3 | import ai.djl.repository.zoo.ZooModel; 4 | import io.quarkus.builder.item.SimpleBuildItem; 5 | import io.quarkus.runtime.RuntimeValue; 6 | 7 | /** 8 | * A {@link io.quarkus.builder.item.BuildItem} holding a {@link ZooModel}. 9 | */ 10 | public final class DjlModelBuildItem extends SimpleBuildItem { 11 | 12 | private final RuntimeValue> value; 13 | 14 | public DjlModelBuildItem(RuntimeValue> value) { 15 | this.value = value; 16 | } 17 | 18 | public RuntimeValue> getValue() { 19 | return value; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /quarkus/extension/runtime/src/main/java/ai/djl/quarkus/runtime/DjlPredictorProducer.java: -------------------------------------------------------------------------------- 1 | package ai.djl.quarkus.runtime; 2 | 3 | import ai.djl.inference.Predictor; 4 | import ai.djl.repository.zoo.ZooModel; 5 | import ai.djl.translate.Translator; 6 | import javax.enterprise.context.ApplicationScoped; 7 | import javax.enterprise.context.Dependent; 8 | import javax.enterprise.inject.Produces; 9 | 10 | /** 11 | * An injectable dependency that creates a {@link Predictor} using the model described in the 12 | * Quarkus Configuration. 13 | */ 14 | @ApplicationScoped 15 | public class DjlPredictorProducer { 16 | 17 | private volatile ZooModel model; 18 | 19 | void initialize(ZooModel model) { 20 | this.model = model; 21 | } 22 | 23 | @Produces 24 | public ZooModel model() { 25 | return model; 26 | } 27 | 28 | @Produces 29 | public Predictor predictor() { 30 | return model.newPredictor(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /quarkus/extension/runtime/src/main/resources/META-INF/quarkus-extension.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "DJL client" 3 | metadata: 4 | keywords: 5 | - "deep learning" 6 | guide: "https://quarkus.io/guides/djl" 7 | categories: 8 | - "data" 9 | status: "preview" 10 | -------------------------------------------------------------------------------- /visualization-vue/.gitignore: -------------------------------------------------------------------------------- 1 | *.params 2 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-demo/.mvn/wrapper/.gitignore: -------------------------------------------------------------------------------- 1 | maven-wapper.jar 2 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-demo/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-demo/src/main/java/org/example/training/data/MetricInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package org.example.training.data; 14 | 15 | import lombok.Builder; 16 | import lombok.Data; 17 | 18 | @Data 19 | @Builder 20 | public class MetricInfo { 21 | 22 | private String name; 23 | private Integer x; 24 | private Float y; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-demo/src/main/java/org/example/training/data/ModelInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package org.example.training.data; 14 | 15 | import lombok.Builder; 16 | import lombok.Data; 17 | 18 | @Data 19 | @Builder 20 | public class ModelInfo { 21 | 22 | private String name; 23 | private String block; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-demo/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8088 3 | 4 | spring: 5 | servlet: 6 | multipart: 7 | enabled: true 8 | max-file-size: 30MB 9 | max-request-size: 30MB 10 | 11 | model: 12 | mnist: ./model/mnist -------------------------------------------------------------------------------- /visualization-vue/djl-training-demo/src/test/resources/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/visualization-vue/djl-training-demo/src/test/resources/0.png -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | insert_final_newline = false 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.env.development: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'development' 3 | 4 | # base api 5 | VUE_APP_BASE_API = 'http://localhost:8088' 6 | 7 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.env.production: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'production' 3 | 4 | # base api 5 | VUE_APP_BASE_API = 'http://localhost:8088' 6 | 7 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.env.staging: -------------------------------------------------------------------------------- 1 | NODE_ENV = production 2 | 3 | # just a flag 4 | ENV = 'staging' 5 | 6 | # base api 7 | VUE_APP_BASE_API = '/stage-api' 8 | 9 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | src/assets 3 | public 4 | dist 5 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | 3 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 10 3 | script: npm run test 4 | notifications: 5 | email: false 6 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app 4 | '@vue/cli-plugin-babel/preset' 5 | ], 6 | 'env': { 7 | 'development': { 8 | // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). 9 | // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. 10 | // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html 11 | 'plugins': ['dynamic-import-node'] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], 3 | transform: { 4 | '^.+\\.vue$': 'vue-jest', 5 | '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 6 | 'jest-transform-stub', 7 | '^.+\\.jsx?$': 'babel-jest' 8 | }, 9 | moduleNameMapper: { 10 | '^@/(.*)$': '/src/$1' 11 | }, 12 | snapshotSerializers: ['jest-serializer-vue'], 13 | testMatch: [ 14 | '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' 15 | ], 16 | collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], 17 | coverageDirectory: '/tests/unit/coverage', 18 | // 'collectCoverage': true, 19 | 'coverageReporters': [ 20 | 'lcov', 21 | 'text-summary' 22 | ], 23 | testURL: 'http://localhost/' 24 | } 25 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "@/*": ["src/*"] 6 | } 7 | }, 8 | "exclude": ["node_modules", "dist"] 9 | } 10 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/postcss.config.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | 'plugins': { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | 'autoprefixer': {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/visualization-vue/djl-training-ui/public/favicon.png -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= webpackConfig.name %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/api/inference.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function mnistImageUrl(data) { 4 | return request({ 5 | url: '/inference/mnistImageUrl', 6 | method: 'get', 7 | params: { 8 | url: data.url 9 | } 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/api/training.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function train(id) { 4 | return request({ 5 | url: '/train/trigger', 6 | method: 'get', 7 | params: { 8 | id: id 9 | } 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/assets/404_images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/visualization-vue/djl-training-ui/src/assets/404_images/404.png -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/assets/404_images/404_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/visualization-vue/djl-training-ui/src/assets/404_images/404_cloud.png -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/layout/components/AppMain.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | 32 | 33 | 41 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/layout/components/Sidebar/FixiOSBug.js: -------------------------------------------------------------------------------- 1 | export default { 2 | computed: { 3 | device() { 4 | return this.$store.state.app.device 5 | } 6 | }, 7 | mounted() { 8 | // In order to fix the click on menu on the ios device will trigger the mouseleave bug 9 | // https://github.com/PanJiaChen/vue-element-admin/issues/1135 10 | this.fixBugIniOS() 11 | }, 12 | methods: { 13 | fixBugIniOS() { 14 | const $subMenu = this.$refs.subMenu 15 | if ($subMenu) { 16 | const handleMouseleave = $subMenu.handleMouseleave 17 | $subMenu.handleMouseleave = (e) => { 18 | if (this.device === 'mobile') { 19 | return 20 | } 21 | handleMouseleave(e) 22 | } 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/layout/components/Sidebar/Item.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 42 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/layout/components/Sidebar/Link.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 44 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/layout/components/index.js: -------------------------------------------------------------------------------- 1 | export { default as Navbar } from './Navbar' 2 | export { default as Sidebar } from './Sidebar' 3 | export { default as AppMain } from './AppMain' 4 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import 'normalize.css/normalize.css' // A modern alternative to CSS resets 4 | 5 | import ElementUI from 'element-ui' 6 | import 'element-ui/lib/theme-chalk/index.css' 7 | import locale from 'element-ui/lib/locale/lang/en' // lang i18n 8 | 9 | import '@/styles/index.scss' // global css 10 | 11 | import App from './App' 12 | import store from './store' 13 | import router from './router' 14 | 15 | import '@/permission' // permission control 16 | 17 | // set ElementUI lang to EN 18 | Vue.use(ElementUI, { locale }) 19 | // 如果想要中文版 element-ui,按如下方式声明 20 | // Vue.use(ElementUI) 21 | 22 | Vue.config.productionTip = false 23 | 24 | new Vue({ 25 | el: '#app', 26 | router, 27 | store, 28 | render: h => h(App) 29 | }) 30 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/permission.js: -------------------------------------------------------------------------------- 1 | import router from './router' 2 | import NProgress from 'nprogress' // progress bar 3 | import 'nprogress/nprogress.css' // progress bar style 4 | import getPageTitle from '@/utils/get-page-title' 5 | 6 | NProgress.configure({ showSpinner: false }) // NProgress Configuration 7 | 8 | router.beforeEach(async(to, from, next) => { 9 | // start progress bar 10 | NProgress.start() 11 | 12 | // set page title 13 | document.title = getPageTitle(to.meta.title) 14 | 15 | if (to.path === '/login') { 16 | // if is logged in, redirect to the home page 17 | next({ path: '/' }) 18 | NProgress.done() 19 | } else { 20 | next() 21 | } 22 | }) 23 | 24 | router.afterEach(() => { 25 | // finish progress bar 26 | NProgress.done() 27 | }) 28 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/settings.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | title: 'DJL Training UI', 4 | 5 | /** 6 | * @type {boolean} true | false 7 | * @description Whether fix the header 8 | */ 9 | fixedHeader: false, 10 | 11 | /** 12 | * @type {boolean} true | false 13 | * @description Whether show the logo in sidebar 14 | */ 15 | sidebarLogo: false 16 | } 17 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/store/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | sidebar: state => state.app.sidebar, 3 | device: state => state.app.device, 4 | token: state => state.user.token, 5 | avatar: state => state.user.avatar, 6 | name: state => state.user.name 7 | } 8 | export default getters 9 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import getters from './getters' 4 | import app from './modules/app' 5 | import settings from './modules/settings' 6 | 7 | Vue.use(Vuex) 8 | 9 | const store = new Vuex.Store({ 10 | modules: { 11 | app, 12 | settings 13 | }, 14 | getters 15 | }) 16 | 17 | export default store 18 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/store/modules/settings.js: -------------------------------------------------------------------------------- 1 | import defaultSettings from '@/settings' 2 | 3 | const { showSettings, fixedHeader, sidebarLogo } = defaultSettings 4 | 5 | const state = { 6 | showSettings: showSettings, 7 | fixedHeader: fixedHeader, 8 | sidebarLogo: sidebarLogo 9 | } 10 | 11 | const mutations = { 12 | CHANGE_SETTING: (state, { key, value }) => { 13 | // eslint-disable-next-line no-prototype-builtins 14 | if (state.hasOwnProperty(key)) { 15 | state[key] = value 16 | } 17 | } 18 | } 19 | 20 | const actions = { 21 | changeSetting({ commit }, data) { 22 | commit('CHANGE_SETTING', data) 23 | } 24 | } 25 | 26 | export default { 27 | namespaced: true, 28 | state, 29 | mutations, 30 | actions 31 | } 32 | 33 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/styles/element-ui.scss: -------------------------------------------------------------------------------- 1 | // cover some element-ui styles 2 | 3 | .el-breadcrumb__inner, 4 | .el-breadcrumb__inner a { 5 | font-weight: 400 !important; 6 | } 7 | 8 | .el-upload { 9 | input[type="file"] { 10 | display: none !important; 11 | } 12 | } 13 | 14 | .el-upload__input { 15 | display: none; 16 | } 17 | 18 | 19 | // to fixed https://github.com/ElemeFE/element/issues/2461 20 | .el-dialog { 21 | transform: none; 22 | left: 0; 23 | position: relative; 24 | margin: 0 auto; 25 | } 26 | 27 | // refine element ui upload 28 | .upload-container { 29 | .el-upload { 30 | width: 100%; 31 | 32 | .el-upload-dragger { 33 | width: 100%; 34 | height: 200px; 35 | } 36 | } 37 | } 38 | 39 | // dropdown 40 | .el-dropdown-menu { 41 | a { 42 | display: block 43 | } 44 | } 45 | 46 | // to fix el-date-picker css style 47 | .el-range-separator { 48 | box-sizing: content-box; 49 | } 50 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/styles/mixin.scss: -------------------------------------------------------------------------------- 1 | @mixin clearfix { 2 | &:after { 3 | content: ""; 4 | display: table; 5 | clear: both; 6 | } 7 | } 8 | 9 | @mixin scrollBar { 10 | &::-webkit-scrollbar-track-piece { 11 | background: #d3dce6; 12 | } 13 | 14 | &::-webkit-scrollbar { 15 | width: 6px; 16 | } 17 | 18 | &::-webkit-scrollbar-thumb { 19 | background: #99a9bf; 20 | border-radius: 20px; 21 | } 22 | } 23 | 24 | @mixin relative { 25 | position: relative; 26 | width: 100%; 27 | height: 100%; 28 | } 29 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/styles/transition.scss: -------------------------------------------------------------------------------- 1 | // global transition css 2 | 3 | /* fade */ 4 | .fade-enter-active, 5 | .fade-leave-active { 6 | transition: opacity 0.28s; 7 | } 8 | 9 | .fade-enter, 10 | .fade-leave-active { 11 | opacity: 0; 12 | } 13 | 14 | /* fade-transform */ 15 | .fade-transform-leave-active, 16 | .fade-transform-enter-active { 17 | transition: all .5s; 18 | } 19 | 20 | .fade-transform-enter { 21 | opacity: 0; 22 | transform: translateX(-30px); 23 | } 24 | 25 | .fade-transform-leave-to { 26 | opacity: 0; 27 | transform: translateX(30px); 28 | } 29 | 30 | /* breadcrumb transition */ 31 | .breadcrumb-enter-active, 32 | .breadcrumb-leave-active { 33 | transition: all .5s; 34 | } 35 | 36 | .breadcrumb-enter, 37 | .breadcrumb-leave-active { 38 | opacity: 0; 39 | transform: translateX(20px); 40 | } 41 | 42 | .breadcrumb-move { 43 | transition: all .5s; 44 | } 45 | 46 | .breadcrumb-leave-active { 47 | position: absolute; 48 | } 49 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/styles/variables.scss: -------------------------------------------------------------------------------- 1 | // sidebar 2 | $menuText:#bfcbd9; 3 | $menuActiveText:#409EFF; 4 | $subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 5 | 6 | $menuBg:#304156; 7 | $menuHover:#263445; 8 | 9 | $subMenuBg:#1f2d3d; 10 | $subMenuHover:#001528; 11 | 12 | $sideBarWidth: 210px; 13 | 14 | // the :export directive is the magic sauce for webpack 15 | // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass 16 | :export { 17 | menuText: $menuText; 18 | menuActiveText: $menuActiveText; 19 | subMenuActiveText: $subMenuActiveText; 20 | menuBg: $menuBg; 21 | menuHover: $menuHover; 22 | subMenuBg: $subMenuBg; 23 | subMenuHover: $subMenuHover; 24 | sideBarWidth: $sideBarWidth; 25 | } 26 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/utils/get-page-title.js: -------------------------------------------------------------------------------- 1 | import defaultSettings from '@/settings' 2 | 3 | const title = defaultSettings.title || 'Vue Admin Template' 4 | 5 | export default function getPageTitle(pageTitle) { 6 | if (pageTitle) { 7 | return `${pageTitle} - ${title}` 8 | } 9 | return `${title}` 10 | } 11 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/utils/validate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {string} path 3 | * @returns {Boolean} 4 | */ 5 | export function isExternal(path) { 6 | return /^(https?:|mailto:|tel:)/.test(path) 7 | } 8 | 9 | /** 10 | * @param {string} str 11 | * @returns {Boolean} 12 | */ 13 | export function validUsername(str) { 14 | const valid_map = ['admin', 'editor'] 15 | return valid_map.indexOf(str.trim()) >= 0 16 | } 17 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/src/views/dashboard/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 17 | 18 | 29 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/tests/unit/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | jest: true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/tests/unit/components/Hamburger.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Hamburger from '@/components/Hamburger/index.vue' 3 | describe('Hamburger.vue', () => { 4 | it('toggle click', () => { 5 | const wrapper = shallowMount(Hamburger) 6 | const mockFn = jest.fn() 7 | wrapper.vm.$on('toggleClick', mockFn) 8 | wrapper.find('.hamburger').trigger('click') 9 | expect(mockFn).toBeCalled() 10 | }) 11 | it('prop isActive', () => { 12 | const wrapper = shallowMount(Hamburger) 13 | wrapper.setProps({ isActive: true }) 14 | expect(wrapper.contains('.is-active')).toBe(true) 15 | wrapper.setProps({ isActive: false }) 16 | expect(wrapper.contains('.is-active')).toBe(false) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/tests/unit/components/SvgIcon.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import SvgIcon from '@/components/SvgIcon/index.vue' 3 | describe('SvgIcon.vue', () => { 4 | it('iconClass', () => { 5 | const wrapper = shallowMount(SvgIcon, { 6 | propsData: { 7 | iconClass: 'test' 8 | } 9 | }) 10 | expect(wrapper.find('use').attributes().href).toBe('#icon-test') 11 | }) 12 | it('className', () => { 13 | const wrapper = shallowMount(SvgIcon, { 14 | propsData: { 15 | iconClass: 'test' 16 | } 17 | }) 18 | expect(wrapper.classes().length).toBe(1) 19 | wrapper.setProps({ className: 'test' }) 20 | expect(wrapper.classes().includes('test')).toBe(true) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/tests/unit/utils/formatTime.spec.js: -------------------------------------------------------------------------------- 1 | import { formatTime } from '@/utils/index.js' 2 | 3 | describe('Utils:formatTime', () => { 4 | const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" 5 | const retrofit = 5 * 1000 6 | 7 | it('ten digits timestamp', () => { 8 | expect(formatTime((d / 1000).toFixed(0))).toBe('7月13日17时54分') 9 | }) 10 | it('test now', () => { 11 | expect(formatTime(+new Date() - 1)).toBe('刚刚') 12 | }) 13 | it('less two minute', () => { 14 | expect(formatTime(+new Date() - 60 * 2 * 1000 + retrofit)).toBe('2分钟前') 15 | }) 16 | it('less two hour', () => { 17 | expect(formatTime(+new Date() - 60 * 60 * 2 * 1000 + retrofit)).toBe('2小时前') 18 | }) 19 | it('less one day', () => { 20 | expect(formatTime(+new Date() - 60 * 60 * 24 * 1 * 1000)).toBe('1天前') 21 | }) 22 | it('more than one day', () => { 23 | expect(formatTime(d)).toBe('7月13日17时54分') 24 | }) 25 | it('format', () => { 26 | expect(formatTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') 27 | expect(formatTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') 28 | expect(formatTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/tests/unit/utils/param2Obj.spec.js: -------------------------------------------------------------------------------- 1 | import { param2Obj } from '@/utils/index.js' 2 | describe('Utils:param2Obj', () => { 3 | const url = 'https://github.com/PanJiaChen/vue-element-admin?name=bill&age=29&sex=1&field=dGVzdA==&key=%E6%B5%8B%E8%AF%95' 4 | 5 | it('param2Obj test', () => { 6 | expect(param2Obj(url)).toEqual({ 7 | name: 'bill', 8 | age: '29', 9 | sex: '1', 10 | field: window.btoa('test'), 11 | key: '测试' 12 | }) 13 | }) 14 | }) 15 | -------------------------------------------------------------------------------- /visualization-vue/djl-training-ui/tests/unit/utils/validate.spec.js: -------------------------------------------------------------------------------- 1 | import { validUsername, isExternal } from '@/utils/validate.js' 2 | 3 | describe('Utils:validate', () => { 4 | it('validUsername', () => { 5 | expect(validUsername('admin')).toBe(true) 6 | expect(validUsername('editor')).toBe(true) 7 | expect(validUsername('xxxx')).toBe(false) 8 | }) 9 | it('isExternal', () => { 10 | expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true) 11 | expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true) 12 | expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false) 13 | expect(isExternal('/dashboard')).toBe(false) 14 | expect(isExternal('./dashboard')).toBe(false) 15 | expect(isExternal('dashboard')).toBe(false) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /visualization-vue/inference.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/visualization-vue/inference.png -------------------------------------------------------------------------------- /visualization-vue/training.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/visualization-vue/training.png -------------------------------------------------------------------------------- /web-demo/doodle_game/backend/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | apply(file("../../../tools/gradle/javaFormatter.gradle.kts")) 5 | 6 | group = "ai.djl.examples.doodle" 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | mavenCentral() 11 | mavenLocal() 12 | maven("https://central.sonatype.com/repository/maven-snapshots/") 13 | } 14 | 15 | dependencies { 16 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 17 | implementation("ai.djl:api") 18 | implementation("ai.djl.pytorch:pytorch-engine") 19 | implementation("com.amazonaws:aws-lambda-java-core:${property("aws_lambda_version")}") 20 | 21 | runtimeOnly("org.slf4j:slf4j-simple:${property("slf4j_version")}") 22 | } 23 | 24 | tasks { 25 | register("buildZip") { 26 | dependsOn(jar) 27 | archiveFileName = "${archiveBaseName}.zip" 28 | from(compileJava) 29 | from(processResources) 30 | into("lib") { 31 | from(configurations.runtimeClasspath) 32 | } 33 | } 34 | 35 | build{ 36 | dependsOn("buildZip") 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /web-demo/doodle_game/backend/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../../gradle.properties -------------------------------------------------------------------------------- /web-demo/doodle_game/backend/gradlew: -------------------------------------------------------------------------------- 1 | ../../../gradlew -------------------------------------------------------------------------------- /web-demo/doodle_game/backend/src/main/java/ai/djl/examples/doodle/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package ai.djl.examples.doodle; 14 | 15 | public class Request { 16 | 17 | private String imageData; 18 | 19 | public String getImageData() { 20 | return imageData; 21 | } 22 | 23 | public void setImageData(String imageData) { 24 | this.imageData = imageData; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /web-demo/doodle_game/frontend/app.css: -------------------------------------------------------------------------------- 1 | #draw { 2 | width: 100%; 3 | overflow: hidden; 4 | } 5 | -------------------------------------------------------------------------------- /web-demo/interactive-console/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.springframework.boot") version "4.0.0-M2" 3 | java 4 | } 5 | apply(file("../../tools/gradle/javaFormatter.gradle.kts")) 6 | 7 | apply(plugin = "io.spring.dependency-management") 8 | 9 | group = "ai.djl.examples" 10 | version = "0.0.1-SNAPSHOT" 11 | 12 | repositories { 13 | mavenCentral() 14 | mavenLocal() 15 | maven("https://central.sonatype.com/repository/maven-snapshots/") 16 | } 17 | 18 | dependencies { 19 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 20 | 21 | implementation("org.springframework.boot:spring-boot-starter-web") 22 | implementation("org.apache.commons:commons-compress:${property("commons_compress_version")}") 23 | implementation("javax.servlet:javax.servlet-api:${property("servlet_version")}") 24 | 25 | runtimeOnly("ai.djl:api") 26 | runtimeOnly("ai.djl.pytorch:pytorch-model-zoo") 27 | runtimeOnly("ai.djl.mxnet:mxnet-model-zoo") 28 | runtimeOnly("ai.djl.tensorflow:tensorflow-model-zoo") 29 | } 30 | 31 | -------------------------------------------------------------------------------- /web-demo/interactive-console/gradle.properties: -------------------------------------------------------------------------------- 1 | ../../gradle.properties -------------------------------------------------------------------------------- /web-demo/interactive-console/gradlew: -------------------------------------------------------------------------------- 1 | ../../gradlew -------------------------------------------------------------------------------- /web-demo/interactive-console/img/blockrunner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/web-demo/interactive-console/img/blockrunner.gif -------------------------------------------------------------------------------- /web-demo/interactive-console/img/terminal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/web-demo/interactive-console/img/terminal.gif -------------------------------------------------------------------------------- /web-demo/interactive-console/settings.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/web-demo/interactive-console/settings.gradle.kts -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/java/ai/djl/examples/jshell/JshellApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance 5 | * with the License. A copy of the License is located at 6 | * 7 | * http://aws.amazon.com/apache2.0/ 8 | * 9 | * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 10 | * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions 11 | * and limitations under the License. 12 | */ 13 | package ai.djl.examples.jshell; 14 | 15 | import org.springframework.boot.SpringApplication; 16 | import org.springframework.boot.autoconfigure.SpringBootApplication; 17 | 18 | @SpringBootApplication 19 | public class JshellApplication { 20 | 21 | public static void main(String[] args) { 22 | SpringApplication.run(JshellApplication.class, args); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/web-demo/interactive-console/src/main/resources/application.properties -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/resources/starter/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jan 16 22:46:13 PST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 7 | -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/resources/starter/mxnet.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | 5 | group = 'ai.djl.examples' 6 | version = '0.0.1-SNAPSHOT' 7 | 8 | repositories { 9 | mavenCentral() 10 | mavenLocal() 11 | maven("https://central.sonatype.com/repository/maven-snapshots/") 12 | } 13 | 14 | java { 15 | sourceCompatibility = JavaVersion.VERSION_11 16 | targetCompatibility = JavaVersion.VERSION_11 17 | } 18 | 19 | dependencies { 20 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 21 | implementation("ai.djl:api") 22 | runtimeOnly("ai.djl.mxnet:mxnet-model-zoo") 23 | } 24 | -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/resources/starter/pytorch.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | 5 | group = 'ai.djl.examples' 6 | version = '0.0.1-SNAPSHOT' 7 | 8 | repositories { 9 | mavenCentral() 10 | mavenLocal() 11 | maven("https://central.sonatype.com/repository/maven-snapshots/") 12 | } 13 | 14 | java { 15 | sourceCompatibility = JavaVersion.VERSION_11 16 | targetCompatibility = JavaVersion.VERSION_11 17 | } 18 | 19 | dependencies { 20 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 21 | implementation("ai.djl:api") 22 | runtimeOnly("ai.djl.pytorch:pytorch-model-zoo") 23 | } 24 | -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/resources/starter/settings.gradle.kts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepjavalibrary/djl-demo/f71758e42e7bf4c6c233a83a9dbcef17599a583b/web-demo/interactive-console/src/main/resources/starter/settings.gradle.kts -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/resources/starter/tensorflow.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | java 3 | } 4 | 5 | group = 'ai.djl.examples' 6 | version = '0.0.1-SNAPSHOT' 7 | 8 | repositories { 9 | mavenCentral() 10 | mavenLocal() 11 | maven("https://central.sonatype.com/repository/maven-snapshots/") 12 | } 13 | 14 | java { 15 | sourceCompatibility = JavaVersion.VERSION_11 16 | targetCompatibility = JavaVersion.VERSION_11 17 | } 18 | 19 | dependencies { 20 | implementation(platform("ai.djl:bom:${property("djl_version")}")) 21 | implementation("ai.djl:api") 22 | runtimeOnly("ai.djl.tensorflow:tensorflow-model-zoo") 23 | } 24 | -------------------------------------------------------------------------------- /web-demo/interactive-console/src/main/webapps/jshell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | --------------------------------------------------------------------------------