mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(ml): use strict mypy (#5001)
* improved typing * improved export typing * strict mypy & check export folder * formatting * add formatting checks for export folder * re-added init call
This commit is contained in:
parent
9fa9ad05b1
commit
935f471ccb
10 changed files with 70 additions and 55 deletions
|
|
@ -66,7 +66,7 @@ class ImageClassifier(InferenceModel):
|
|||
def _predict(self, image: Image.Image | bytes) -> list[str]:
|
||||
if isinstance(image, bytes):
|
||||
image = Image.open(BytesIO(image))
|
||||
predictions: list[dict[str, Any]] = self.model(image) # type: ignore
|
||||
predictions: list[dict[str, Any]] = self.model(image)
|
||||
tags = [tag for pred in predictions for tag in pred["label"].split(", ") if pred["score"] >= self.min_score]
|
||||
|
||||
return tags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue