llm / models /text_to_image.py
eienmojiki's picture
Update models/text_to_image.py
7080eee verified
from pydantic import BaseModel, Field
from typing import List, Optional
class TextToImageRequest(BaseModel):
prompt: str = Field(..., description="The prompt to generate an image from.")
negative_prompt: Optional[str] = Field(None, description="One or several prompts to guide what NOT to include in image generation.")
height: Optional[int] = Field(None, description="The height in pixels of the image to generate.", ge=64, le=2048)
width: Optional[int] = Field(None, description="The width in pixels of the image to generate.", ge=64, le=2048)
num_inference_steps: Optional[int] = Field(None, description="The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference.", ge=1, le=500)
guidance_scale: Optional[float] = Field(None, description="A higher guidance scale value encourages the model to generate images closely linked to the text prompt, but values too high may cause saturation and other artifacts.", ge=1, le=20)
model: Optional[str] = Field(None, description="The model to use for inference. Can be a model ID hosted on the Hugging Face Hub or a URL to a deployed Inference Endpoint. If not provided, the default recommended text-to-image model will be used.")
scheduler: Optional[str] = Field(None, description="Override the scheduler with a compatible one.")
#target_size: Optional[TextToImageTargetSize] = Field(None, description="The size in pixel of the output image")
seed: Optional[int] = Field(None, description="Seed for the random number generator.")