admin管理员组文章数量:1123704
I have explored the Google Imagen 3 Multimodal model to replace an object with another object generated by a prompt using the API.
I am trying to explore the possibility of replacing an object with another object that is provided by me , instead of being generated by a prompt.
Any ideas on how to do it? Will grounding the Imagen 3 model or function calling help? I am using the following code, as you can see the replacement object is generated by the prompt and is not being provided as a static object.
I want to be able to provide a picture of my corgi instead of using a prompt to generate a picture of the corgi.
image_prompt = """
a french bulldog sitting in a living room on a couch with green throw pillows and a throw blanket,
a circular mirror with a slim black border is on the wall above the couch
"""
generated_image = generation_model.generate_images(
prompt=image_prompt,
number_of_images=1,
aspect_ratio="1:1",
safety_filter_level="block_some",
person_generation="dont_allow",
)
edit_prompt = "a corgi sitting on a couch"
raw_ref_image = RawReferenceImage(image=generated_image[0], reference_id=0)
mask_ref_image = MaskReferenceImage(
reference_id=1,
image=None,
mask_mode="semantic",
segmentation_classes=[8],
dilation=0.1,
)
edited_image = edit_model.edit_image(
prompt=edit_prompt,
edit_mode="inpainting-insert",
reference_images=[raw_ref_image, mask_ref_image],
number_of_images=1,
safety_filter_level="block_some",
person_generation="allow_adult",
)
display_images(generated_image[0], edited_image[0])
本文标签: Inpainting insert with a custom image using Imagen 3 on Google GeminiStack Overflow
版权声明:本文标题:Inpainting insert with a custom image using Imagen 3 on Google Gemini - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736591406a1945083.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论