2024-10-19 18:49:44 +00:00
|
|
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
2024-10-28 23:23:43 +00:00
|
|
|
import org.jetbrains.compose.internal.de.undercouch.gradle.tasks.download.Download
|
2024-10-19 18:49:44 +00:00
|
|
|
|
|
|
|
|
plugins {
|
2024-10-28 00:46:18 +00:00
|
|
|
val kotlinVersion = "2.0.21"
|
2024-10-28 23:23:43 +00:00
|
|
|
|
2024-10-28 00:46:18 +00:00
|
|
|
kotlin("jvm") version kotlinVersion
|
|
|
|
|
kotlin("plugin.serialization") version kotlinVersion
|
2024-10-19 18:49:44 +00:00
|
|
|
id("org.jetbrains.compose")
|
|
|
|
|
id("org.jetbrains.kotlin.plugin.compose")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group = "xyz.r0r5chach"
|
|
|
|
|
version = "1.0-SNAPSHOT"
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
|
mavenCentral()
|
|
|
|
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
|
|
|
|
|
google()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
2024-10-24 22:52:44 +00:00
|
|
|
|
|
|
|
|
// Core
|
2024-10-19 18:49:44 +00:00
|
|
|
implementation(compose.desktop.currentOs)
|
|
|
|
|
|
2024-10-25 19:52:47 +00:00
|
|
|
// ConstrainLayout
|
|
|
|
|
implementation("tech.annexflow.compose:constraintlayout-compose-multiplatform:0.4.0")
|
|
|
|
|
|
2024-10-24 22:52:44 +00:00
|
|
|
// Material Design
|
|
|
|
|
implementation(compose.materialIconsExtended)
|
|
|
|
|
|
2024-10-28 23:23:43 +00:00
|
|
|
//Java Native Access
|
|
|
|
|
val jnaVersion = "5.15.0"
|
2024-10-24 22:52:44 +00:00
|
|
|
implementation("net.java.dev.jna:jna:$jnaVersion")
|
|
|
|
|
implementation("net.java.dev.jna:jna-platform:$jnaVersion")
|
|
|
|
|
|
2024-10-23 17:31:04 +00:00
|
|
|
//Coroutines
|
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
2024-10-19 18:49:44 +00:00
|
|
|
|
2024-10-24 22:52:44 +00:00
|
|
|
// Voyager
|
2024-10-28 23:23:43 +00:00
|
|
|
val voyagerVersion = "1.1.0-beta02"
|
2024-10-24 22:52:44 +00:00
|
|
|
implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
|
|
|
|
|
implementation("cafe.adriel.voyager:voyager-screenmodel:$voyagerVersion")
|
|
|
|
|
implementation("cafe.adriel.voyager:voyager-bottom-sheet-navigator:$voyagerVersion")
|
|
|
|
|
implementation("cafe.adriel.voyager:voyager-tab-navigator:$voyagerVersion")
|
|
|
|
|
implementation("cafe.adriel.voyager:voyager-transitions:$voyagerVersion")
|
|
|
|
|
|
2024-10-28 23:23:43 +00:00
|
|
|
// Speech to Text
|
|
|
|
|
implementation("com.alphacephei:vosk:0.3.45")
|
|
|
|
|
|
2024-10-24 22:52:44 +00:00
|
|
|
// Deep Java Library
|
2024-10-28 23:23:43 +00:00
|
|
|
val djlVersion = "0.30.0"
|
2024-10-24 22:52:44 +00:00
|
|
|
implementation("ai.djl:api:$djlVersion")
|
|
|
|
|
implementation("ai.djl.huggingface:tokenizers:$djlVersion")
|
|
|
|
|
implementation("ai.djl.pytorch:pytorch-engine:$djlVersion")
|
|
|
|
|
implementation("ai.djl.pytorch:pytorch-jni:2.4.0-$djlVersion")
|
|
|
|
|
|
|
|
|
|
// Semantic Kernel
|
|
|
|
|
implementation("com.microsoft.semantic-kernel:semantickernel-api:1.3.0")
|
|
|
|
|
|
2024-10-25 19:52:47 +00:00
|
|
|
// Logging
|
2024-10-26 18:07:40 +00:00
|
|
|
implementation("io.github.oshai:kotlin-logging-jvm:7.0.0")
|
|
|
|
|
implementation("ch.qos.logback:logback-classic:1.5.11")
|
|
|
|
|
|
2024-10-28 23:23:43 +00:00
|
|
|
// Json
|
|
|
|
|
val serializationVersion = "1.5.1"
|
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")
|
|
|
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
|
2024-10-19 18:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
compose.desktop {
|
|
|
|
|
application {
|
|
|
|
|
mainClass = "MainKt"
|
|
|
|
|
|
|
|
|
|
nativeDistributions {
|
|
|
|
|
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
|
|
|
|
packageName = "mia"
|
|
|
|
|
packageVersion = "1.0.0"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-28 23:23:43 +00:00
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|