Skip to content

directory_artifact

DirectoryArtifact.

Classes:

Name Description
DirectoryArtifact

Represent raw data uploaded to xpdeep cloud or on premise instance under a directory.

DirectoryArtifact #

Represent raw data uploaded to xpdeep cloud or on premise instance under a directory.

Methods:

Name Description
__getitem__

Return file's path in the xpdeep server.

__len__

Give the number of files in the directory.

create_directory_artifact

Create a directory artifact.

delete

Delete DirectoryArtifact and related artifact.

list_directories

Get trained models from a project.

__getitem__(item: str) -> str #

Return file's path in the xpdeep server.

Source code in src/xpdeep/dataset/directory_artifact.py
def __getitem__(self, item: str) -> str:
    """Return file's path in the xpdeep server."""
    return self.files.additional_properties[item]

__len__() -> int #

Give the number of files in the directory.

Source code in src/xpdeep/dataset/directory_artifact.py
def __len__(self) -> int:
    """Give the number of files in the directory."""
    return len(self.files.additional_properties)

create_directory_artifact(name: str, file_paths: dict[str, str]) -> DirectoryArtifact #

Create a directory artifact.

Source code in src/xpdeep/dataset/directory_artifact.py
@classmethod
@initialized_client_verification
@initialized_project_verification
def create_directory_artifact(cls, name: str, file_paths: dict[str, str]) -> "DirectoryArtifact":
    """Create a directory artifact."""
    body = DirectoryCreateRequestBody(
        directory_artifact_name=name, dataset_paths=DirectoryCreateRequestBodyDatasetpaths.from_dict(file_paths)
    )

    return DirectoryArtifact.from_dict(
        cast(
            DirectoryModel,
            create_directory.sync(Project.CURRENT.get().model.id, client=ClientFactory.CURRENT.get()(), body=body),
        ).to_dict()
    )

delete() -> None #

Delete DirectoryArtifact and related artifact.

Source code in src/xpdeep/dataset/directory_artifact.py
@initialized_client_verification
@initialized_project_verification
def delete(self) -> None:
    """Delete DirectoryArtifact and related artifact."""
    delete_directories.sync(Project.CURRENT.get().model.id, client=ClientFactory.CURRENT.get()(), ids=[self.id])

list_directories() -> list[Self] #

Get trained models from a project.

Source code in src/xpdeep/dataset/directory_artifact.py
@classmethod
@initialized_client_verification
@initialized_project_verification
def list_directories(cls) -> list[Self]:
    """Get trained models from a project."""
    return [
        cls.from_dict(directory_model.to_dict())
        for directory_model in cast(
            list[DirectoryModel],
            get_many_directories.sync(Project.CURRENT.get().model.id, client=ClientFactory.CURRENT.get()()),
        )
    ]