Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Empty response from Imagen 3 with status 200

I am trying to generate image with Imagen 3.
I have tried REST and Python library.
For some reason I get response 200 with no images in it.
My prompt that fails is "President of a country is meeting with president of another country."
While the prompt "President of a country" return image just fine.
I came to a conclusion that the first prompt is somehow breaking rules, but it is confusing as at
 the same time when I enter the same first prompt on the ImageFX website it generates images just fine.

0 1 244
1 REPLY 1

Hi @ApsidD,

Welcome to Google Cloud Community!

It appears that you're encountering an issue with the specific prompt when generating images using the Imagen 3 model, particularly when it involves two presidents meeting. This is likely due to the mention of political figures, which may trigger a safety mechanism. This would explain why you're receiving a 200 response (success) but no image, as the API might be silently preventing the generation due to policy concerns.

Here are a few possible reasons why this is happening, along with potential solutions you can consider to address the issue:

  • Content Filtering: Some image generation models, including Imagen 3, may have filters in place to avoid generating content related to sensitive or potentially political topics (like images of specific presidents or international relations). These filters might be flagging the first prompt, as it could be interpreted as generating images involving real-world political figures or events.
  • Model Policy: The fact that the same prompt works on the ImageFX website suggests that there might be different content moderation policies or levels of strictness between the API and the website. It's possible that the website has a more lenient approach or different rules regarding the depiction of political figures in generated images.
  • Prompt Complexity: The specific wording of your prompt ("President of a country is meeting with president of another country") may be too complex or vague for the model to generate a coherent image. Breaking the prompt down into simpler terms might help, e.g., "Two people shaking hands in an office setting."
  • Rephrase the Prompt: Try rewording your prompt to avoid directly referring to political figures.
  • Use Generic Terms: If possible, replace specific references to "president" with more generic terms like "leaders" or "officials" to avoid triggering any content moderation filters.
  • Test with Other Prompts: Try generating other prompts that involve meetings or diplomatic situations without directly mentioning specific titles. This can help confirm if it's the mention of "president" that's triggering the issue.

You can read through this documentation for detailed information on safety filtering and blocked content handling when using Imagen.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.