File size: 1,581 Bytes
5b01a80
 
 
 
 
c5a8f52
9606545
 
b39b086
 
5b01a80
 
062a468
5b01a80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.")