LumenAi

object LumenAi(source)

Lumen AI's entry point.

Install it once, in Application.onCreate, before anything else here runs: background indexing and model downloads start in their own process launches and need it.

LumenAi.install(this)                       // every photo and video, default settings
LumenAi.models.download(context, ModelPack.Search)
val results = LumenAi.search(context, "cat sleeping on a chair")

Properties

Link copied to clipboard

The installed host.

Link copied to clipboard

Background indexing: when it runs, and how far it has got.

Link copied to clipboard

Download, check and remove each feature's models.

Link copied to clipboard

The people found in the library: list, name, merge, hide.

Functions

Link copied to clipboard
fun adoptState(context: Context, modelQueue: List<String>, textVideoVersion: Int)

For an app that kept the download queue and video-text version itself before using the library: hands them over once, so nothing is lost or redone. Later calls do nothing.

Link copied to clipboard
fun install(host: LumenAiHost)

Installs Lumen AI with a host of your own, for full control over every setting.

fun install(context: Context, configure: LumenAiConfig.() -> Unit = {})

Installs Lumen AI with defaults: it indexes every photo and video on the phone (from MediaStore), shows its own notification icon, and opens your launcher activity from its notifications. Change any of that in configure.

Link copied to clipboard
suspend fun labels(context: Context, mediaId: Long, max: Int = 3): List<String>

Up to max words that describe a photo, e.g. "cat", "beach". Needs Smart Search.

Link copied to clipboard
suspend fun liveText(context: Context, item: MediaRef): LiveText.Result?

The lines of text in a photo, with their positions, for selecting and copying. Instant for indexed photos; others are read now (about a second) and kept. Null when it has no text or the Text feature isn't downloaded.

suspend fun liveText(context: Context, item: MediaRef, atMs: Long): LiveText.Result?

The text in one frame of a video, at atMs: for a paused video.

Link copied to clipboard
suspend fun search(context: Context, query: String): SearchResults

Searches the library, the way Lumen does. Words in quotes find that exact phrase in the text of photos and videos. Two or more names find the photos with all of those people. Otherwise, photos whose text has the words come first, then Smart Search's matches. Uses whichever features are downloaded; empty results when none are.

Link copied to clipboard
fun subtitles(context: Context, item: MediaRef, fromMs: Long = 0): Flow<List<Cue>>

Makes subtitles for a video, starting at fromMs, and emits all cues so far as each part is done. Made parts are kept, so calling it again continues. Needs Subtitles; ARM only.

Link copied to clipboard
suspend fun suggestions(context: Context): List<Suggestion>

Search suggestions drawn from the library: things there are many photos of.