Skip to content

Image generation failed with error 'Allow (All ages)' not available #19

Description

@hossain-khan

Despite setting up Vertex AI API with billing I am getting following error.

15:06:41.289  E  Unknown error:
com.google.firebase.ai.type.ServerException: Image generation failed with the following error: You have chosen the 'Allow (All ages)' option for Person Generation, but this option is not available to you. If you would like to generate images with people, see the safety settings documentation for more details.
	at com.google.firebase.ai.type.FirebaseAIException$Companion.from$com_google_firebase_firebase_ai(Exceptions.kt:43)
	at com.google.firebase.ai.ImagenModel.generateImages(ImagenModel.kt:82)
	at com.google.firebase.ai.ImagenModel$generateImages$1.invokeSuspend(Unknown Source:15)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)

Changing ImagenPersonFilterLevel.ALLOW_ALL to ImagenPersonFilterLevel.ALLOW_ADULT does work for me. However what is the right path here?

private fun createGenerativeImageModel(): ImagenModel {
return Firebase.ai.imagenModel(
remoteConfigDataSource.imageModelName(),
safetySettings =
ImagenSafetySettings(
ImagenSafetyFilterLevel.BLOCK_LOW_AND_ABOVE,
personFilterLevel = ImagenPersonFilterLevel.ALLOW_ALL,
),
)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions