fclip / src /models.py
pediot's picture
first commit
88e0bae
raw
history blame contribute delete
399 Bytes
from pydantic import BaseModel
from typing import List
from PIL.Image import Image
from .utils import download_image_as_pil
class TextRequest(BaseModel):
texts: List[str]
class ImageRequest(BaseModel):
urls: List[str]
def download(self) -> List[Image]:
return [download_image_as_pil(url) for url in self.urls]
class Response(BaseModel):
embeddings: List[List[float]]