|
| 1 | +from pydantic import BaseModel, Field |
| 2 | + |
| 3 | + |
| 4 | +class RevePostprocessingOperation(BaseModel): |
| 5 | + process: str = Field(..., description="The postprocessing operation: upscale or remove_background.") |
| 6 | + upscale_factor: int | None = Field( |
| 7 | + None, |
| 8 | + description="Upscale factor (2, 3, or 4). Only used when process is upscale.", |
| 9 | + ge=2, |
| 10 | + le=4, |
| 11 | + ) |
| 12 | + |
| 13 | + |
| 14 | +class ReveImageCreateRequest(BaseModel): |
| 15 | + prompt: str = Field(...) |
| 16 | + aspect_ratio: str | None = Field(...) |
| 17 | + version: str = Field(...) |
| 18 | + test_time_scaling: int = Field( |
| 19 | + ..., |
| 20 | + description="If included, the model will spend more effort making better images. Values between 1 and 15.", |
| 21 | + ge=1, |
| 22 | + le=15, |
| 23 | + ) |
| 24 | + postprocessing: list[RevePostprocessingOperation] | None = Field( |
| 25 | + None, description="Optional postprocessing operations to apply after generation." |
| 26 | + ) |
| 27 | + |
| 28 | + |
| 29 | +class ReveImageEditRequest(BaseModel): |
| 30 | + edit_instruction: str = Field(...) |
| 31 | + reference_image: str = Field(..., description="A base64 encoded image to use as reference for the edit.") |
| 32 | + aspect_ratio: str | None = Field(...) |
| 33 | + version: str = Field(...) |
| 34 | + test_time_scaling: int | None = Field( |
| 35 | + ..., |
| 36 | + description="If included, the model will spend more effort making better images. Values between 1 and 15.", |
| 37 | + ge=1, |
| 38 | + le=15, |
| 39 | + ) |
| 40 | + postprocessing: list[RevePostprocessingOperation] | None = Field( |
| 41 | + None, description="Optional postprocessing operations to apply after generation." |
| 42 | + ) |
| 43 | + |
| 44 | + |
| 45 | +class ReveImageRemixRequest(BaseModel): |
| 46 | + prompt: str = Field(...) |
| 47 | + reference_images: list[str] = Field(..., description="A list of 1-6 base64 encoded reference images.") |
| 48 | + aspect_ratio: str | None = Field(...) |
| 49 | + version: str = Field(...) |
| 50 | + test_time_scaling: int | None = Field( |
| 51 | + ..., |
| 52 | + description="If included, the model will spend more effort making better images. Values between 1 and 15.", |
| 53 | + ge=1, |
| 54 | + le=15, |
| 55 | + ) |
| 56 | + postprocessing: list[RevePostprocessingOperation] | None = Field( |
| 57 | + None, description="Optional postprocessing operations to apply after generation." |
| 58 | + ) |
| 59 | + |
| 60 | + |
| 61 | +class ReveImageResponse(BaseModel): |
| 62 | + image: str | None = Field(None, description="The base64 encoded image data.") |
| 63 | + request_id: str | None = Field(None, description="A unique id for the request.") |
| 64 | + credits_used: float | None = Field(None, description="The number of credits used for this request.") |
| 65 | + version: str | None = Field(None, description="The specific model version used.") |
| 66 | + content_violation: bool | None = Field( |
| 67 | + None, description="Indicates whether the generated image violates the content policy." |
| 68 | + ) |
0 commit comments