"""Abstract image-edit backend interface.""" from __future__ import annotations from abc import ABC, abstractmethod from PIL import Image class ImageEditBackend(ABC): """Common interface for every Qwen Image Edit engine.""" #: Short identifier stored in dataset metadata. source: str = "image_edit" @abstractmethod def prepare(self) -> None: """Validate credentials / load models. Must raise if unusable.""" @abstractmethod def edit( self, image: Image.Image, prompt: str, seed: int, num_inference_steps: int, true_guidance_scale: float, ) -> Image.Image: """Return an edited copy of ``image`` following ``prompt``. An empty ``prompt`` should return the (resized) original image. """