Skip to content

Commit

Permalink
feat: Import prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim-Encord committed Dec 6, 2024
1 parent e74dca5 commit be2bfa4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions encord/orm/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,7 @@ class CvatImportGetResultResponse(BaseDTO):
status: CvatImportGetResultLongPollingStatus
project_uuid: Optional[UUID] = None
issues: Optional[Dict] = None


class ActivePredictionPayload(BaseDTO):
label_branch_name: str
18 changes: 17 additions & 1 deletion encord/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from encord.collection import ProjectCollection
from encord.common.deprecated import deprecated
from encord.constants.model import AutomationModels, Device
from encord.exceptions import EncordException
from encord.http.bundle import Bundle
from encord.http.v2.api_client import ApiClient
from encord.objects import LabelRowV2, OntologyStructure
Expand All @@ -40,7 +41,14 @@
ShadowDataState,
)
from encord.orm.model import ModelConfiguration, ModelTrainingWeights, TrainingMetadata
from encord.orm.project import CopyDatasetOptions, CopyLabelsOptions, ProjectDataset, ProjectDTO, ProjectType
from encord.orm.project import (
ActivePredictionPayload,
CopyDatasetOptions,
CopyLabelsOptions,
ProjectDataset,
ProjectDTO,
ProjectType,
)
from encord.orm.project import Project as OrmProject
from encord.project_ontology.classification_type import ClassificationType
from encord.project_ontology.object_type import ObjectShape
Expand Down Expand Up @@ -1227,3 +1235,11 @@ def create_collection(
self._client._get_api_client(), self._project_instance.project_hash, name, description, collection_type
)
return self.get_collection(new_uuid)

def import_prediction(self, label_branch_name: str) -> None:
self._client._get_api_client().post(
path=f"active/{self.project_hash}/predictions",
params=None,
payload=ActivePredictionPayload(label_branch_name=label_branch_name),
result_type=None,
)

0 comments on commit be2bfa4

Please sign in to comment.