mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
95cfe22866
* cuda and openvino ep, refactor, update dockerfile * updated workflow * typing fixes * added tests * updated ml test gh action * updated README * updated docker-compose * added compute to hwaccel.yml * updated gh matrix updated gh matrix updated gh matrix updated gh matrix updated gh matrix give up * remove cuda/arm64 build * add hwaccel image tags to docker-compose * remove unnecessary quotes * add suffix to git tag * fixed kwargs in base model * armnn ld_library_path * update pyproject.toml * add armnn workflow * formatting * consolidate hwaccel files, update docker compose * update hw transcoding docs * add ml hwaccel docs * update dev and prod docker-compose * added armnn prerequisite docs * support 3.10 * updated docker-compose comments * formatting * test coverage * don't set arena extend strategy for openvino * working openvino * formatting * fix dockerfile * added type annotation * add wsl configuration for openvino * updated lock file * copy python3 * comment out extends section * fix platforms * simplify workflow suffix tagging * simplify aio transcoding doc * update docs and workflow for `hwaccel.yml` change * revert docs
46 lines
952 B
Python
46 lines
952 B
Python
from enum import Enum
|
|
from typing import Any, Protocol, TypedDict, TypeGuard
|
|
|
|
import numpy as np
|
|
import numpy.typing as npt
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class TextResponse(BaseModel):
|
|
__root__: str
|
|
|
|
|
|
class MessageResponse(BaseModel):
|
|
message: str
|
|
|
|
|
|
class BoundingBox(TypedDict):
|
|
x1: int
|
|
y1: int
|
|
x2: int
|
|
y2: int
|
|
|
|
|
|
class ModelType(str, Enum):
|
|
CLIP = "clip"
|
|
FACIAL_RECOGNITION = "facial-recognition"
|
|
|
|
|
|
class HasProfiling(Protocol):
|
|
profiling: dict[str, float]
|
|
|
|
|
|
class Face(TypedDict):
|
|
boundingBox: BoundingBox
|
|
embedding: npt.NDArray[np.float32]
|
|
imageWidth: int
|
|
imageHeight: int
|
|
score: float
|
|
|
|
|
|
def has_profiling(obj: Any) -> TypeGuard[HasProfiling]:
|
|
return hasattr(obj, "profiling") and isinstance(obj.profiling, dict)
|
|
|
|
|
|
def is_ndarray(obj: Any, dtype: "type[np._DTypeScalar_co]") -> "TypeGuard[npt.NDArray[np._DTypeScalar_co]]":
|
|
return isinstance(obj, np.ndarray) and obj.dtype == dtype
|