File size: 805 Bytes
f2ec79c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""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.
        """