Can anyone give me code to genrate image from Text by Flash models

Documentation code is not working

Hi @Yash_G,

Welcome to the Forum!

To help us in understanding the image generation issue, please provide a code snippet of your attempts. Have you used the gemini-2.0-flash-preview-image-generation or Imagen model for this purpose? See Image generation  |  Gemini API  |  Google AI for Developers for generating an image from a descriptive prompt.

Thank you!