Skip to content

Commit 67e1dfe

Browse files
author
David Motsonashvili
committed
format
1 parent 83a29c1 commit 67e1dfe

File tree

1 file changed

+12
-19
lines changed
  • firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai

1 file changed

+12
-19
lines changed

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/ImagenModel.kt

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@ import com.google.firebase.vertexai.type.ImagenGenerationConfig
3434
import com.google.firebase.vertexai.type.ImagenGenerationResponse
3535
import com.google.firebase.vertexai.type.ImagenInlineImage
3636
import com.google.firebase.vertexai.type.ImagenSafetySettings
37-
import com.google.firebase.vertexai.type.ImagenSafetySettings
38-
import com.google.firebase.vertexai.type.PromptBlockedException
3937
import com.google.firebase.vertexai.type.RequestOptions
40-
import kotlin.time.Duration
41-
import kotlin.time.Duration.Companion.seconds
42-
import kotlinx.coroutines.tasks.await
4338

4439
/**
4540
* Represents an image model (like Imagen), capable of generating images based on various input
@@ -74,16 +69,14 @@ internal constructor(
7469
),
7570
)
7671

77-
/**
78-
* Generates an image, returning the result directly to the caller.
79-
* @param prompt The main text prompt from which the image is generated.
80-
* @param config contains secondary image generation parameters.
81-
*/
72+
/**
73+
* Generates an image, returning the result directly to the caller.
74+
* @param prompt The main text prompt from which the image is generated.
75+
* @param config contains secondary image generation parameters.
76+
*/
8277
public suspend fun generateImages(prompt: String): ImagenGenerationResponse<ImagenInlineImage> =
8378
try {
84-
controller
85-
.generateImage(constructRequest(prompt, null, generationConfig))
86-
.toPublicInline()
79+
controller.generateImage(constructRequest(prompt, null, generationConfig)).toPublicInline()
8780
controller
8881
.generateImage(constructRequest(prompt, null, generationConfig))
8982
.validate()
@@ -92,12 +85,12 @@ internal constructor(
9285
throw FirebaseVertexAIException.from(e)
9386
}
9487

95-
/**
96-
* Generates an image, storing the result in Google Cloud Storage and returning a URL
97-
* @param prompt The main text prompt from which the image is generated.
98-
* @param gcsUri Specifies the GCS bucket in which to store the image.
99-
* @param config contains secondary image generation parameters.
100-
*/
88+
/**
89+
* Generates an image, storing the result in Google Cloud Storage and returning a URL
90+
* @param prompt The main text prompt from which the image is generated.
91+
* @param gcsUri Specifies the GCS bucket in which to store the image.
92+
* @param config contains secondary image generation parameters.
93+
*/
10194
public suspend fun generateImages(
10295
prompt: String,
10396
gcsUri: String,

0 commit comments

Comments
 (0)