Spaces:
Sleeping
Sleeping
| from abc import ABC, abstractmethod | |
| from typing import List, Dict, Any | |
| from PIL import Image | |
| class UnifiedModelInterface(ABC): | |
| def load(self) -> None: | |
| """Lazy load all required components (models, indices, vocab, etc.)""" | |
| pass | |
| def generate_caption(self, image: Image.Image) -> str: | |
| pass | |
| def text_to_image(self, text: str, top_k: int = 5) -> List[Dict[str, Any]]: | |
| """Returns [{'image_path': str, 'score': float}, ...]""" | |
| pass | |
| def image_to_text(self, image: Image.Image, top_k: int = 5) -> List[str]: | |
| """Returns list of caption strings""" | |
| pass | |
| def image_to_image(self, image: Image.Image, top_k: int = 5) -> List[Dict[str, Any]]: | |
| pass | |
| def text_to_text(self, text: str, top_k: int = 5) -> List[Dict[str, Any]]: | |
| raise NotImplementedError("Text-to-text not supported by this model") |