File size: 399 Bytes
88e0bae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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]]
|