android_studio/samples/media/video/download_model.gradle
2026-06-26 03:26:01 +04:00

52 lines
2.2 KiB
Groovy

/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
task downloadModelFile(type: Download) {
src 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/task_library/style_transfer/android/magenta_arbitrary-image-stylization-v1-256_int8_prediction_1.tflite'
dest project.ext.ASSET_DIR + '/predict_int8.tflite'
overwrite false
}
task downloadModelFile0(type: Download) {
src 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/task_library/style_transfer/android/magenta_arbitrary-image-stylization-v1-256_int8_transfer_1.tflite'
dest project.ext.ASSET_DIR + '/transfer_int8.tflite'
overwrite false
}
task downloadModelFile1(type: Download) {
src 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/task_library/style_transfer/android/magenta_arbitrary-image-stylization-v1-256_fp16_prediction_1.tflite'
dest project.ext.ASSET_DIR + '/predict_float16.tflite'
overwrite false
}
task downloadModelFile2(type: Download) {
src 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/task_library/style_transfer/android/magenta_arbitrary-image-stylization-v1-256_fp16_transfer_1.tflite'
dest project.ext.ASSET_DIR + '/transfer_float16.tflite'
overwrite false
}
task copyTestModel(type: Copy, dependsOn: downloadModelFile1) {
from project.ext.ASSET_DIR + '/predict_float16.tflite'
into project.ext.TEST_ASSETS_DIR
}
task copyTestModel0(type: Copy, dependsOn: downloadModelFile2) {
from project.ext.ASSET_DIR + '/transfer_float16.tflite'
into project.ext.TEST_ASSETS_DIR
}
preBuild.dependsOn downloadModelFile, downloadModelFile1, downloadModelFile2,
copyTestModel, copyTestModel0