|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | - |
4 | | -import torch |
5 | | - |
6 | 3 | from enum import Enum |
7 | 4 | from typing import Optional, Union |
8 | 5 |
|
| 6 | +import torch |
9 | 7 | from pydantic import BaseModel, Field, confloat |
10 | 8 |
|
11 | 9 |
|
12 | | - |
13 | 10 | class LumaIO: |
14 | 11 | LUMA_REF = "LUMA_REF" |
15 | 12 | LUMA_CONCEPTS = "LUMA_CONCEPTS" |
@@ -183,13 +180,13 @@ class LumaAssets(BaseModel): |
183 | 180 |
|
184 | 181 |
|
185 | 182 | class LumaImageRef(BaseModel): |
186 | | - '''Used for image gen''' |
| 183 | + """Used for image gen""" |
187 | 184 | url: str = Field(..., description='The URL of the image reference') |
188 | 185 | weight: confloat(ge=0.0, le=1.0) = Field(..., description='The weight of the image reference') |
189 | 186 |
|
190 | 187 |
|
191 | 188 | class LumaImageReference(BaseModel): |
192 | | - '''Used for video gen''' |
| 189 | + """Used for video gen""" |
193 | 190 | type: Optional[str] = Field('image', description='Input type, defaults to image') |
194 | 191 | url: str = Field(..., description='The URL of the image') |
195 | 192 |
|
@@ -251,3 +248,32 @@ class LumaGeneration(BaseModel): |
251 | 248 | assets: Optional[LumaAssets] = Field(None, description='The assets of the generation') |
252 | 249 | model: str = Field(..., description='The model used for the generation') |
253 | 250 | request: Union[LumaGenerationRequest, LumaImageGenerationRequest] = Field(..., description="The request used for the generation") |
| 251 | + |
| 252 | + |
| 253 | +class Luma2ImageRef(BaseModel): |
| 254 | + url: str | None = None |
| 255 | + data: str | None = None |
| 256 | + media_type: str | None = None |
| 257 | + |
| 258 | + |
| 259 | +class Luma2GenerationRequest(BaseModel): |
| 260 | + prompt: str = Field(..., min_length=1, max_length=6000) |
| 261 | + model: str | None = None |
| 262 | + type: str | None = None |
| 263 | + aspect_ratio: str | None = None |
| 264 | + style: str | None = None |
| 265 | + output_format: str | None = None |
| 266 | + web_search: bool | None = None |
| 267 | + image_ref: list[Luma2ImageRef] | None = None |
| 268 | + source: Luma2ImageRef | None = None |
| 269 | + |
| 270 | + |
| 271 | +class Luma2Generation(BaseModel): |
| 272 | + id: str | None = None |
| 273 | + type: str | None = None |
| 274 | + state: str | None = None |
| 275 | + model: str | None = None |
| 276 | + created_at: str | None = None |
| 277 | + output: list[LumaImageReference] | None = None |
| 278 | + failure_reason: str | None = None |
| 279 | + failure_code: str | None = None |
0 commit comments