updated deprecated pydantic config
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
"""Definition of VisualCommunication model."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from base64 import b64decode
|
||||
from base64 import b64encode
|
||||
from base64 import b64decode, b64encode
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
|
||||
from minio import Minio
|
||||
from PIL import Image
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from pymongo.collection import Collection
|
||||
|
||||
from shared.data_store import get
|
||||
from shared.data_store import put
|
||||
from shared.data_store import get, put
|
||||
from shared.dto import ModelData
|
||||
|
||||
|
||||
@@ -24,10 +23,7 @@ class VisualCommunication(BaseModel):
|
||||
object_name: str
|
||||
annotation: ModelData | None = None
|
||||
prediction: ModelData | None = None
|
||||
|
||||
class Config:
|
||||
"""BaseModel configuration."""
|
||||
arbitrary_types_allowed = True
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
@classmethod
|
||||
def classname(cls) -> str:
|
||||
@@ -58,10 +54,8 @@ class VisualCommunication(BaseModel):
|
||||
image: Image.Image,
|
||||
minio_client: Minio,
|
||||
) -> VisualCommunication:
|
||||
"""
|
||||
Instantiate from filename and image
|
||||
that is automatically uploaded to MinIO.
|
||||
"""
|
||||
"""Instantiate from filename and image that is automatically uploaded
|
||||
to MinIO."""
|
||||
assert isinstance(name, str)
|
||||
assert isinstance(image, Image.Image)
|
||||
assert isinstance(minio_client, Minio)
|
||||
|
||||
Reference in New Issue
Block a user