How does AI generate image from text?

The model has been trained by studying an extensive set of images and their descriptions, much like a student learning from countless textbooks and examples. This training allows the AI to understand the connection between words and visual elements.