mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
34402cc46a
- add `list_images` endpoint at `GET api/v1/images` - extend `ImageStorageBase` with `list()` method, implemented it for `DiskImageStorage` - add `ImageReponse` class to for image responses, which includes urls, metadata - add `ImageMetadata` class (basically a stub at the moment) - uploaded images now named `"{uuid}_{timestamp}.png"` - add `models` modules. besides separating concerns more clearly, this helps to mitigate circular dependencies - improve thumbnail handling
27 lines
655 B
Python
27 lines
655 B
Python
from enum import Enum
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ImageType(str, Enum):
|
|
RESULT = "results"
|
|
INTERMEDIATE = "intermediates"
|
|
UPLOAD = "uploads"
|
|
|
|
|
|
class ImageField(BaseModel):
|
|
"""An image field used for passing image objects between invocations"""
|
|
|
|
image_type: str = Field(
|
|
default=ImageType.RESULT, description="The type of the image"
|
|
)
|
|
image_name: Optional[str] = Field(default=None, description="The name of the image")
|
|
|
|
class Config:
|
|
schema_extra = {
|
|
"required": [
|
|
"image_type",
|
|
"image_name",
|
|
]
|
|
}
|