feat: add resource library and real image workflow

This commit is contained in:
afei A
2026-03-29 00:24:29 +08:00
parent eeaff269eb
commit 04da401ab4
38 changed files with 3033 additions and 117 deletions

View 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: ...