@@ -383,7 +383,16 @@ def _generate_images(
383
383
output_gcs_uri : Optional [str ] = None ,
384
384
add_watermark : Optional [bool ] = None ,
385
385
safety_filter_level : Optional [
386
- Literal ["block_most" , "block_some" , "block_few" , "block_fewest" ]
386
+ Literal [
387
+ "block_most" ,
388
+ "block_some" ,
389
+ "block_few" ,
390
+ "block_fewest" ,
391
+ "block_low_and_above" ,
392
+ "block_medium_and_above" ,
393
+ "block_only_high" ,
394
+ "block_none" ,
395
+ ]
387
396
] = None ,
388
397
person_generation : Optional [
389
398
Literal ["dont_allow" , "allow_adult" , "allow_all" ]
@@ -411,11 +420,13 @@ def _generate_images(
411
420
base_image: Base image to use for the image generation.
412
421
mask: Mask for the base image.
413
422
edit_mode: Describes the editing mode for the request. Supported values
414
- are - * inpainting-insert: fills the mask area based on the text
415
- prompt (requires mask and text) * inpainting-remove: removes the
416
- object(s) in the mask area. (requires mask)
423
+ are -
424
+ * inpainting-insert: fills the mask area based on the text
425
+ prompt (requires mask and text)
426
+ * inpainting-remove: removes the object(s) in the mask area. (requires mask)
417
427
* outpainting: extend the image based on the mask area. (Requires
418
- mask) * product-image: Changes the background for the predominant
428
+ mask)
429
+ * product-image: Changes the background for the predominant
419
430
product or subject in the image
420
431
mask_mode: Solicits generation of the mask (v/s providing mask as an
421
432
input). Supported values are:
@@ -433,8 +444,9 @@ class ID
433
444
* fixed: Fixed position
434
445
* reposition: Can be moved (default)
435
446
output_mime_type: Which image format should the output be saved as.
436
- Supported values: * image/png: Save as a PNG image * image/jpeg: Save
437
- as a JPEG image
447
+ Supported values:
448
+ * image/png: Save as a PNG image
449
+ * image/jpeg: Save as a JPEG image
438
450
compression_quality: Level of compression if the output mime type is
439
451
selected to be image/jpeg. Float between 0 to 100
440
452
language: Language of the text prompt for the image. Default: None.
@@ -444,14 +456,26 @@ class ID
444
456
output_gcs_uri: Google Cloud Storage uri to store the generated images.
445
457
add_watermark: Add a watermark to the generated image
446
458
safety_filter_level: Adds a filter level to Safety filtering. Supported
447
- values are: * "block_most" : Strongest filtering level, most strict
448
- blocking * "block_some" : Block some problematic prompts and responses
449
- * "block_few" : Block fewer problematic prompts and responses *
450
- "block_fewest" : Block very few problematic prompts and responses
459
+ values are:
460
+ * block_most : Strongest filtering level, most strict
461
+ blocking
462
+ * block_some : Block some problematic prompts and responses
463
+ * block_few : Block fewer problematic prompts and responses
464
+ * block_fewest : Block very few problematic prompts and
465
+ responses
466
+ For Imagen 3.0 and Imagen 2.0 Editing (model_name:
467
+ `imagen-3.0-generate-001`, `imagen-3.0-fast-generate-001`,
468
+ `imagen-2.0-edit-preview-0627` and `imagegeneration@006`), the
469
+ following safety filter levels are supported:
470
+ * block_low_and_above : Block low and above safety scores
471
+ * block_medium_and_above : Block medium and above safety scores
472
+ * block_only_high : Block only high safety scores
473
+ * block_none : Block nothing
451
474
person_generation: Allow generation of people by the model Supported
452
- values are: * "dont_allow" : Block generation of people *
453
- "allow_adult" : Generate adults, but not children * "allow_all" :
454
- Generate adults and children
475
+ values are:
476
+ * dont_allow : Block generation of people
477
+ * allow_adult : Generate adults, but not children
478
+ * allow_all : Generate adults and children
455
479
456
480
Returns:
457
481
An `ImageGenerationResponse` object.
0 commit comments