Skip to content

Commit 6226ba6

Browse files
author
David Motsonashvili
committed
format
1 parent c763af9 commit 6226ba6

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

firebase-ai/app/src/main/java/com/google/firebase/quickstart/ai/FirebaseAISamples.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package com.google.firebase.quickstart.ai
22

3-
import android.content.Context
4-
import android.content.res.Resources
53
import android.graphics.Bitmap
6-
import android.graphics.BitmapFactory
74
import com.google.firebase.ai.ImagenModel
85
import com.google.firebase.ai.type.Dimensions
96
import com.google.firebase.ai.type.FunctionDeclaration
@@ -170,8 +167,11 @@ val FIREBASE_AI_SAMPLES = listOf(
170167
includeAttach = true,
171168
allowEmptyPrompt = true,
172169
radioOptions = listOf("Background", "Foreground"),
173-
generateImages = { model: ImagenModel, inputText: String, bitmap: Bitmap?, selectedRadioOption:String? ->
174-
val mask = when(selectedRadioOption) {
170+
generateImages = { model: ImagenModel,
171+
inputText: String,
172+
bitmap: Bitmap?,
173+
selectedRadioOption: String? ->
174+
val mask = when (selectedRadioOption) {
175175
"Foreground" -> ImagenForegroundMask()
176176
else -> ImagenBackgroundMask()
177177
}
@@ -193,8 +193,11 @@ val FIREBASE_AI_SAMPLES = listOf(
193193
includeAttach = true,
194194
allowEmptyPrompt = true,
195195
radioOptions = listOf("Center", "Top", "Bottom", "Left", "Right"),
196-
generateImages = { model: ImagenModel, inputText: String, bitmap: Bitmap?, selectedRadioOption: String? ->
197-
val position = when(selectedRadioOption) {
196+
generateImages = { model: ImagenModel,
197+
inputText: String,
198+
bitmap: Bitmap?,
199+
selectedRadioOption: String? ->
200+
val position = when (selectedRadioOption) {
198201
"Top" -> ImagenImagePlacement.TOP_CENTER
199202
"Bottom" -> ImagenImagePlacement.BOTTOM_CENTER
200203
"Left" -> ImagenImagePlacement.LEFT_CENTER
@@ -253,7 +256,8 @@ val FIREBASE_AI_SAMPLES = listOf(
253256
model.editImage(
254257
listOf(
255258
ImagenRawImage(MainActivity.catImage.toImagenInlineImage()),
256-
ImagenStyleReference(bitmap!!.toImagenInlineImage(), 1, "an art style")),
259+
ImagenStyleReference(bitmap!!.toImagenInlineImage(), 1, "an art style")
260+
),
257261
"Generate an image in an art style [1] based on the following caption: $inputText",
258262
)
259263
}

firebase-ai/app/src/main/java/com/google/firebase/quickstart/ai/ui/navigation/Sample.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ data class Sample(
4141
val includeAttach: Boolean = false,
4242
val allowEmptyPrompt: Boolean = false,
4343
val radioOptions: List<String> = emptyList(),
44-
val generateImages: (suspend (ImagenModel, String, Bitmap?, String?) -> ImagenGenerationResponse<ImagenInlineImage>)? = null
44+
val generateImages: (suspend (ImagenModel,
45+
String,
46+
Bitmap?,
47+
String?) -> ImagenGenerationResponse<ImagenInlineImage>)? = null
4548
)

0 commit comments

Comments
 (0)