BonsaiNativeBridge

internal object BonsaiNativeBridge(source)

Thin Kotlin boundary around the Android Bonsai native library.

The bridge centralizes library loading, model probing, generation, progress callbacks, and cancellation so the rest of the feature never calls JNI entry points directly.

Types

Link copied to clipboard

JNI callback used by the native runtime to report completed diffusion steps.

Properties

Link copied to clipboard
Link copied to clipboard
private val loadResult: Result<Unit>

Functions

Link copied to clipboard
Link copied to clipboard
fun generate(layout: AndroidBonsaiModelLayout, prompt: String, negativePrompt: String, samplingSteps: Int, cfgScale: Float, width: Int, height: Int, seed: String, batchCount: Int, allowNsfw: Boolean, backend: String, callback: BonsaiNativeBridge.ProgressCallback): String
Link copied to clipboard
private external fun generateModel(rootPath: String, packedTransformerPath: String, textEncoderPath: String, tokenizerPath: String, vaePath: String, schedulerPath: String, prompt: String, negativePrompt: String, samplingSteps: Int, cfgScale: Float, width: Int, height: Int, seed: String, batchCount: Int, allowNsfw: Boolean, backend: String, callback: BonsaiNativeBridge.ProgressCallback): String
Link copied to clipboard
external fun interrupt()
Link copied to clipboard
Link copied to clipboard
private external fun probeModel(rootPath: String, packedTransformerPath: String, textEncoderPath: String, tokenizerPath: String, vaePath: String, schedulerPath: String): String