Download src/models.py from precove/fclip: direct link, hf CLI and curl.
- Browser
- Download file 399 Bytes
-
https://huggingface.co/spaces/precove/fclip/resolve/main/src/models.py
- Command line
-
hf download hf://spaces/precove/fclip/src/models.py
-
curl -L -o models.py https://huggingface.co/spaces/precove/fclip/resolve/main/src/models.py
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]] | |