Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add safety filter levels, watermark support and person generati…
…on support for Imagen 2 Changelog: - Added `add_watermark` option to `generate_image` call for adding a SynthID watermark to generated images. - Added a `edit_mode` option to `edit_image` call. Can now choose between 4 edit modes - - `inpainting-insert` : Edit the image within the masked region. Needs both mask and prompt - `inpainting-remove`: Remove objects within the masked region. Needs only mask - `outpainting`: Extend the image based on the mask area. - `product-image`: Changes background for primary subject of the image - Added a `mask_mode` option to `edit_image` call. Can now choose between 3 mask generation modes, instead of providing masks: - `background`: Select everything except the primary subject(s) of the image - `foreground`: Select the primary subject(s) of the image - `semantic`: Segment one or more of the segmentation classes using class ID - Added a `segmentation_classes` option for passing a list of class IDs when `semantic` mask_mode is used. Can send upto 5 classes - Added a `mask_dilation` option for setting the dilation percentage of mask - Added a `product_position` option to allow repositioning of products in the image. Supported values are: - `reposition`: Products can be repositioned - `fixed`: Product location is fixed - Added a `output_mime_type` option to select which image format should the output be returned as. Supported values are: - `image/png` - `image/jpeg` - Added a `compression_quality` option to select compression quality when output is `image/jpeg`. - Added a safety filter level for selecting the level of prompt and image filtering by Responsible AI filters. Supported values are: - `"block_most"` : The strictest filter. Blocks most - `"block_some"` : Second most strict filter. Blocks some prompts and images - `"block_few"` : Blocks a few prompts and images - `"block_fewest"`: Blocks fewest prompts and images - Added an option to control person generation. Supported values are: - `"dont_allow"` : Don't generate people at all - `"allow_adults"`: Generate adults, but not children - `"allow_all"` : Allows all person generation - Added the WatermarkVerificationModel to check if an image has a SynthID watermark. The publisher model is `imageverification@001`. The model object contains just one call, `verify_image`. `verify_image` takes only an image as the input and returns a string with one of 2 values: - `ACCEPT` : The image contains a watermark - `REJECT` : The image does not contain a watermark PiperOrigin-RevId: 617924430
- Loading branch information