Added build tasks
This commit is contained in:
parent
335ccae93d
commit
d5ff6a1a0a
104
build.gradle.kts
104
build.gradle.kts
|
|
@ -1,7 +1,9 @@
|
||||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||||
|
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
val kotlinVersion = "2.0.21"
|
val kotlinVersion = "2.0.21"
|
||||||
|
|
||||||
kotlin("jvm") version kotlinVersion
|
kotlin("jvm") version kotlinVersion
|
||||||
kotlin("plugin.serialization") version kotlinVersion
|
kotlin("plugin.serialization") version kotlinVersion
|
||||||
id("org.jetbrains.compose")
|
id("org.jetbrains.compose")
|
||||||
|
|
@ -18,9 +20,6 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
val djlVersion = "0.30.0"
|
|
||||||
val jnaVersion = "5.15.0"
|
|
||||||
val voyagerVersion = "1.1.0-beta02"
|
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
implementation(compose.desktop.currentOs)
|
implementation(compose.desktop.currentOs)
|
||||||
|
|
@ -31,10 +30,8 @@ dependencies {
|
||||||
// Material Design
|
// Material Design
|
||||||
implementation(compose.materialIconsExtended)
|
implementation(compose.materialIconsExtended)
|
||||||
|
|
||||||
// Speech to Text
|
//Java Native Access
|
||||||
implementation("com.alphacephei:vosk:0.3.45")
|
val jnaVersion = "5.15.0"
|
||||||
|
|
||||||
//Java Native Access var capturing = false
|
|
||||||
implementation("net.java.dev.jna:jna:$jnaVersion")
|
implementation("net.java.dev.jna:jna:$jnaVersion")
|
||||||
implementation("net.java.dev.jna:jna-platform:$jnaVersion")
|
implementation("net.java.dev.jna:jna-platform:$jnaVersion")
|
||||||
|
|
||||||
|
|
@ -42,13 +39,18 @@ dependencies {
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
||||||
|
|
||||||
// Voyager
|
// Voyager
|
||||||
|
val voyagerVersion = "1.1.0-beta02"
|
||||||
implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
|
implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
|
||||||
implementation("cafe.adriel.voyager:voyager-screenmodel:$voyagerVersion")
|
implementation("cafe.adriel.voyager:voyager-screenmodel:$voyagerVersion")
|
||||||
implementation("cafe.adriel.voyager:voyager-bottom-sheet-navigator:$voyagerVersion")
|
implementation("cafe.adriel.voyager:voyager-bottom-sheet-navigator:$voyagerVersion")
|
||||||
implementation("cafe.adriel.voyager:voyager-tab-navigator:$voyagerVersion")
|
implementation("cafe.adriel.voyager:voyager-tab-navigator:$voyagerVersion")
|
||||||
implementation("cafe.adriel.voyager:voyager-transitions:$voyagerVersion")
|
implementation("cafe.adriel.voyager:voyager-transitions:$voyagerVersion")
|
||||||
|
|
||||||
|
// Speech to Text
|
||||||
|
implementation("com.alphacephei:vosk:0.3.45")
|
||||||
|
|
||||||
// Deep Java Library
|
// Deep Java Library
|
||||||
|
val djlVersion = "0.30.0"
|
||||||
implementation("ai.djl:api:$djlVersion")
|
implementation("ai.djl:api:$djlVersion")
|
||||||
implementation("ai.djl.huggingface:tokenizers:$djlVersion")
|
implementation("ai.djl.huggingface:tokenizers:$djlVersion")
|
||||||
implementation("ai.djl.pytorch:pytorch-engine:$djlVersion")
|
implementation("ai.djl.pytorch:pytorch-engine:$djlVersion")
|
||||||
|
|
@ -62,8 +64,9 @@ dependencies {
|
||||||
implementation("ch.qos.logback:logback-classic:1.5.11")
|
implementation("ch.qos.logback:logback-classic:1.5.11")
|
||||||
|
|
||||||
// Json
|
// Json
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
|
val serializationVersion = "1.5.1"
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")
|
||||||
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
compose.desktop {
|
compose.desktop {
|
||||||
|
|
@ -77,3 +80,86 @@ compose.desktop {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("buildLite") {
|
||||||
|
description = "Build program with the small vosk STT model"
|
||||||
|
dependsOn("prepareLiteResources", "build")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("buildFull") {
|
||||||
|
description = "Build program with the large vosk STT model"
|
||||||
|
dependsOn("prepareFullResources", "build")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tasks.register("generateSemanticModel") {
|
||||||
|
description = "Run DJL to generate Semantic model from HuggingFace (all-roberta-large-v1)"
|
||||||
|
|
||||||
|
val exeDir = ""
|
||||||
|
val modelName = "sentence-transformers/all-roberta-large-v1"
|
||||||
|
val djlOutputDir = project.file("src/main/resources/Semantic-model")
|
||||||
|
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
djlOutputDir.deleteRecursively()
|
||||||
|
}
|
||||||
|
doLast {
|
||||||
|
val os = System.getProperty("os.name")
|
||||||
|
val executable = when {
|
||||||
|
os.contains("win") -> project.file("$exeDir/djl-windows.exe")
|
||||||
|
os.contains("mac") -> project.file("$exeDir/djl-mac")
|
||||||
|
os.contains("linux") || os.contains("nix") || os.contains("nux") -> project.file("$exeDir/djl-linux")
|
||||||
|
else -> throw GradleException("Unsupported OS: $os")
|
||||||
|
}
|
||||||
|
|
||||||
|
exec {
|
||||||
|
commandLine = listOf(executable.absolutePath, modelName, djlOutputDir.absolutePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val sttOutputDir = project.file("src/main/resources/STT-model")
|
||||||
|
val modelUrl = "https://alphacephei.com/vosk/models"
|
||||||
|
val zipFile = layout.buildDirectory.file("STT-model.zip")
|
||||||
|
|
||||||
|
tasks.register<Download>("prepareLiteResources") {
|
||||||
|
description = "Download small vosk model to resources"
|
||||||
|
|
||||||
|
val modelName = "vosk-model-small-en-us-0.15"
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
sttOutputDir.deleteRecursively()
|
||||||
|
dependsOn("generateSemanticModel")
|
||||||
|
}
|
||||||
|
|
||||||
|
src("$modelUrl/$modelName.zip")
|
||||||
|
dest(zipFile)
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
project.copy {
|
||||||
|
from(project.zipTree(zipFile))
|
||||||
|
into(sttOutputDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Download>("prepareFullResources") {
|
||||||
|
description = "Download large vosk model to resources"
|
||||||
|
|
||||||
|
val modelName = "vosk-model-en-us-0.22"
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
sttOutputDir.deleteRecursively()
|
||||||
|
dependsOn("generateSemanticModel")
|
||||||
|
}
|
||||||
|
|
||||||
|
src("$modelUrl/$modelName.zip")
|
||||||
|
dest(zipFile)
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
project.copy {
|
||||||
|
from(project.zipTree(zipFile))
|
||||||
|
into(sttOutputDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue