mirror of
https://github.com/google-ai-edge/gallery.git
synced 2025-07-06 06:30:30 -04:00
- Better text formatting on home screen for smaller screen.
- Set default backend based on the order of "accelerators" field in model allowlist
This commit is contained in:
parent
4d0c570d34
commit
e89fd9a23b
6 changed files with 7 additions and 8 deletions
|
@ -30,7 +30,7 @@ android {
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "0.9.2"
|
versionName = "0.9.3"
|
||||||
|
|
||||||
// Needed for HuggingFace auth workflows.
|
// Needed for HuggingFace auth workflows.
|
||||||
manifestPlaceholders["appAuthRedirectScheme"] = "com.google.aiedge.gallery.oauth"
|
manifestPlaceholders["appAuthRedirectScheme"] = "com.google.aiedge.gallery.oauth"
|
||||||
|
|
|
@ -353,7 +353,7 @@ private fun TaskList(
|
||||||
val linkColor = MaterialTheme.customColors.linkColor
|
val linkColor = MaterialTheme.customColors.linkColor
|
||||||
|
|
||||||
val introText = buildAnnotatedString {
|
val introText = buildAnnotatedString {
|
||||||
append("Welcome to Google AI Edge Gallery! Explore a world of \namazing on-device models from ")
|
append("Welcome to Google AI Edge Gallery! Explore a world of amazing on-device models from ")
|
||||||
withLink(
|
withLink(
|
||||||
link = LinkAnnotation.Url(
|
link = LinkAnnotation.Url(
|
||||||
url = "https://huggingface.co/litert-community", // Replace with the actual URL
|
url = "https://huggingface.co/litert-community", // Replace with the actual URL
|
||||||
|
|
|
@ -67,7 +67,7 @@ fun createLlmChatConfigs(
|
||||||
),
|
),
|
||||||
SegmentedButtonConfig(
|
SegmentedButtonConfig(
|
||||||
key = ConfigKey.ACCELERATOR,
|
key = ConfigKey.ACCELERATOR,
|
||||||
defaultValue = if (accelerators.contains(Accelerator.GPU)) Accelerator.GPU.label else accelerators[0].label,
|
defaultValue = accelerators[0].label,
|
||||||
options = accelerators.map { it.label }
|
options = accelerators.map { it.label }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -132,12 +132,8 @@ object LlmChatModelHelper {
|
||||||
input: String,
|
input: String,
|
||||||
resultListener: ResultListener,
|
resultListener: ResultListener,
|
||||||
cleanUpListener: CleanUpListener,
|
cleanUpListener: CleanUpListener,
|
||||||
singleTurn: Boolean = false,
|
|
||||||
image: Bitmap? = null,
|
image: Bitmap? = null,
|
||||||
) {
|
) {
|
||||||
if (singleTurn) {
|
|
||||||
resetSession(model = model)
|
|
||||||
}
|
|
||||||
val instance = model.instance as LlmModelInstance
|
val instance = model.instance as LlmModelInstance
|
||||||
|
|
||||||
// Set listener.
|
// Set listener.
|
||||||
|
|
|
@ -61,6 +61,7 @@ open class LlmChatViewModel(curTask: Task = TASK_LLM_CHAT) : ChatViewModel(task
|
||||||
while (model.instance == null) {
|
while (model.instance == null) {
|
||||||
delay(100)
|
delay(100)
|
||||||
}
|
}
|
||||||
|
delay(500)
|
||||||
|
|
||||||
// Run inference.
|
// Run inference.
|
||||||
val instance = model.instance as LlmModelInstance
|
val instance = model.instance as LlmModelInstance
|
||||||
|
|
|
@ -78,6 +78,9 @@ open class LlmSingleTurnViewModel(val task: Task = TASK_LLM_PROMPT_LAB) : ViewMo
|
||||||
delay(100)
|
delay(100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LlmChatModelHelper.resetSession(model = model)
|
||||||
|
delay(500)
|
||||||
|
|
||||||
// Run inference.
|
// Run inference.
|
||||||
val instance = model.instance as LlmModelInstance
|
val instance = model.instance as LlmModelInstance
|
||||||
val prefillTokens = instance.session.sizeInTokens(input)
|
val prefillTokens = instance.session.sizeInTokens(input)
|
||||||
|
@ -145,7 +148,6 @@ open class LlmSingleTurnViewModel(val task: Task = TASK_LLM_PROMPT_LAB) : ViewMo
|
||||||
setInProgress(false)
|
setInProgress(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
singleTurn = true,
|
|
||||||
cleanUpListener = {
|
cleanUpListener = {
|
||||||
setPreparing(false)
|
setPreparing(false)
|
||||||
setInProgress(false)
|
setInProgress(false)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue