InferBench / api /flux.py
davidberenstein1957's picture
refactor: improve code formatting and organization across multiple API and benchmark files
34046e2
raw
history blame
907 Bytes
from abc import ABC, abstractmethod
from pathlib import Path
class FluxAPI(ABC):
"""
Abstract base class for Flux API implementations.
This class defines the common interface for all Flux API implementations.
"""
@property
@abstractmethod
def name(self) -> str:
"""
The name of the API implementation.
Returns:
str: The name of the specific API implementation
"""
pass
@abstractmethod
def generate_image(self, prompt: str, save_path: Path) -> float:
"""
Generate an image based on the prompt and save it to the specified path.
Args:
prompt (str): The text prompt to generate the image from
save_path (Path): The path where the generated image should be saved
Returns:
float: The time taken for the API call in seconds
"""
pass