src.model.image_model module
Text-to-image model for generating synthetic images from prompts.
This module provides functionality to load and use diffusion-based text-to-image models for generating synthetic images based on text prompts and concepts.
- class src.model.image_model.ImageModel(model_id: str, device: str, model_swapping: str, num_inference_steps: int, guidance_scale: int)[source]
Bases:
ModelText-to-image generation model wrapper.
Wraps diffusion-based text-to-image models to generate synthetic images from text prompts using specified configurations.
- generate_images(n_images: int, prompt_text: str, concept: str) Sequence[PIL.Image.Image][source]
Generate synthetic images for a given concept.
Generates multiple images by passing text prompts combined with a concept through the text-to-image model. Each image uses a different random seed for diversity.
- Parameters:
n_images – Number of images to generate.
prompt_text – Base prompt text to use for generation.
concept – Concept name to include in the image prompt.
- Returns:
Sequence of PIL Image objects generated from the prompts.