feat: add resource library and real image workflow
This commit is contained in:
38
app/infra/image_generation/base.py
Normal file
38
app/infra/image_generation/base.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Shared types for image-generation providers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class SourceImage:
|
||||
"""A binary source image passed into an image-generation provider."""
|
||||
|
||||
url: str
|
||||
mime_type: str
|
||||
data: bytes
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class GeneratedImageResult:
|
||||
"""Normalized image-generation output returned by providers."""
|
||||
|
||||
image_bytes: bytes
|
||||
mime_type: str
|
||||
provider: str
|
||||
model: str
|
||||
prompt: str
|
||||
|
||||
|
||||
class ImageGenerationProvider(Protocol):
|
||||
"""Contract implemented by concrete image-generation providers."""
|
||||
|
||||
async def generate_tryon_image(
|
||||
self,
|
||||
*,
|
||||
prompt: str,
|
||||
person_image: SourceImage,
|
||||
garment_image: SourceImage,
|
||||
) -> GeneratedImageResult: ...
|
||||
Reference in New Issue
Block a user