Spaces:
Running
Running
File size: 907 Bytes
2c50826 34046e2 2c50826 34046e2 2c50826 34046e2 2c50826 |
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 34 35 36 |
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
|