e4dcfc49aa
Tests / Import Check (Python 3.13) (push) Has been cancelled
Tests / Import Check (Python 3.14) (push) Has been cancelled
Tests / Python Tests (Python 3.11) (push) Has been cancelled
Tests / Python Tests (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.14) (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled
Tests / Lint and Format (push) Has been cancelled
Tests / Web Node Tests (push) Has been cancelled
Tests / Import Check (Python 3.11) (push) Has been cancelled
Tests / Import Check (Python 3.12) (push) Has been cancelled
Tests / Python Tests (Python 3.13) (push) Has been cancelled
25 lines
627 B
Python
25 lines
627 B
Python
"""Base abstraction for image-generation adapters."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from deeptutor.services.imagegen.config import ImagegenConfig
|
|
|
|
|
|
class BaseImagegenAdapter(ABC):
|
|
"""Abstract text-to-image adapter."""
|
|
|
|
@abstractmethod
|
|
async def generate(
|
|
self, prompt: str, config: ImagegenConfig, *, n: int = 1
|
|
) -> list[tuple[bytes, str]]:
|
|
"""Generate ``n`` images for ``prompt``.
|
|
|
|
Returns a list of ``(image_bytes, content_type)`` — content type is
|
|
best-effort, e.g. ``image/png``.
|
|
"""
|
|
|
|
|
|
__all__ = ["BaseImagegenAdapter"]
|