# Persian-to-Image Text-to-Image Pipeline ## Model Overview This model pipeline is designed to generate images from Persian text descriptions by translating the Persian text into English and then using a fine-tuned Stable Diffusion model to generate the corresponding image. The pipeline combines two models: a translation model (`mohammad-shirkhani/finetune_persian_to_english_mt5_base_summarize_on_celeba_hq`) and an image generation model (`ebrahim-k/Stable-Diffusion-1_5-FT-celeba_HQ_en`). ## Model Details ### Translation Model - **Model Name**: `mohammad-shirkhani/finetune_persian_to_english_mt5_base_summarize_on_celeba_hq` - **Architecture**: mT5 - **Purpose**: This model is used to translate Persian text into English. It has been fine-tuned specifically on the CelebA-HQ dataset for summarization tasks, making it well-suited for translating descriptions of facial features. ### Image Generation Model - **Model Name**: `ebrahim-k/Stable-Diffusion-1_5-FT-celeba_HQ_en` - **Architecture**: Stable Diffusion 1.5 - **Purpose**: This model generates high-quality images from the English text produced by the translation model. It has been fine-tuned on the CelebA-HQ dataset, making it particularly effective for generating realistic human faces based on text descriptions. ## Pipeline Description The pipeline works as follows: 1. **Text Translation**: The Persian input text is translated into English using the mT5-based translation model. 2. **Image Generation**: The translated English text is then fed into the Stable Diffusion model to generate the corresponding image. ### Example Usage ```python from IPython.display import display # Persian text describing a person persian_text = "این زن دارای موهای موج دار ، لب های بزرگ و موهای قهوه ای است و رژ لب دارد.این زن موهای موج دار و لب های بزرگ دارد و رژ لب دارد.فرد جذاب است و موهای موج دار ، چشم های باریک و موهای قهوه ای دارد." # Generate and display the image image = persian_to_image_model(persian_text) display(image) # Another example persian_text2 = "این مرد جذاب دارای موهای قهوه ای ، سوزش های جانبی ، دهان کمی باز و کیسه های زیر چشم است.این فرد جذاب دارای کیسه های زیر چشم ، سوزش های جانبی و دهان کمی باز است." image2 = persian_to_image_model(persian_text2) display(image2)