mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:29:32 -05:00 
			
		
		
		
	* fix(deps): update machine-learning * updated ruff command * use isinstance --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
		
			
				
	
	
		
			46 lines
		
	
	
		
			938 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			938 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from enum import StrEnum
 | 
						|
from typing import Any, Protocol, TypeAlias, TypedDict, TypeGuard
 | 
						|
 | 
						|
import numpy as np
 | 
						|
from pydantic import BaseModel
 | 
						|
 | 
						|
ndarray_f32: TypeAlias = np.ndarray[int, np.dtype[np.float32]]
 | 
						|
ndarray_i64: TypeAlias = np.ndarray[int, np.dtype[np.int64]]
 | 
						|
ndarray_i32: TypeAlias = np.ndarray[int, np.dtype[np.int32]]
 | 
						|
 | 
						|
 | 
						|
class TextResponse(BaseModel):
 | 
						|
    __root__: str
 | 
						|
 | 
						|
 | 
						|
class MessageResponse(BaseModel):
 | 
						|
    message: str
 | 
						|
 | 
						|
 | 
						|
class BoundingBox(TypedDict):
 | 
						|
    x1: int
 | 
						|
    y1: int
 | 
						|
    x2: int
 | 
						|
    y2: int
 | 
						|
 | 
						|
 | 
						|
class ModelType(StrEnum):
 | 
						|
    CLIP = "clip"
 | 
						|
    FACIAL_RECOGNITION = "facial-recognition"
 | 
						|
 | 
						|
 | 
						|
class HasProfiling(Protocol):
 | 
						|
    profiling: dict[str, float]
 | 
						|
 | 
						|
 | 
						|
class Face(TypedDict):
 | 
						|
    boundingBox: BoundingBox
 | 
						|
    embedding: ndarray_f32
 | 
						|
    imageWidth: int
 | 
						|
    imageHeight: int
 | 
						|
    score: float
 | 
						|
 | 
						|
 | 
						|
def has_profiling(obj: Any) -> TypeGuard[HasProfiling]:
 | 
						|
    return hasattr(obj, "profiling") and isinstance(obj.profiling, dict)
 |