Skip to content

Commit 4be1981

Browse files
committed
stash
1 parent 7601c29 commit 4be1981

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

nucleus/annotation.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def __init__(
3434
height: Union[float, int],
3535
reference_id: str = None,
3636
item_id: str = None,
37+
annotation_id: str = None,
3738
metadata: Optional[Dict] = None,
3839
):
3940
if bool(reference_id) == bool(item_id):
@@ -47,6 +48,7 @@ def __init__(
4748
self.height = height
4849
self.reference_id = reference_id
4950
self.item_id = item_id
51+
self.annotation_id = annotation_id
5052
self.metadata = metadata if metadata else {}
5153

5254
@classmethod
@@ -60,6 +62,7 @@ def from_json(cls, payload: dict):
6062
height=geometry.get(HEIGHT_KEY, 0),
6163
reference_id=payload.get(REFERENCE_ID_KEY, None),
6264
item_id=payload.get(DATASET_ITEM_ID_KEY, None),
65+
annotation_id=payload.get(ANNOTATION_ID, None),
6366
metadata=payload.get(METADATA_KEY, {}),
6467
)
6568

@@ -74,6 +77,7 @@ def to_payload(self) -> dict:
7477
HEIGHT_KEY: self.height,
7578
},
7679
REFERENCE_ID_KEY: self.reference_id,
80+
ANNOTATION_ID: self.annotation_id,
7781
METADATA_KEY: self.metadata,
7882
}
7983

@@ -89,6 +93,7 @@ def __init__(
8993
vertices: List[Any],
9094
reference_id: str = None,
9195
item_id: str = None,
96+
annotation_id: str = None,
9297
metadata: Optional[Dict] = None,
9398
):
9499
if bool(reference_id) == bool(item_id):
@@ -99,6 +104,7 @@ def __init__(
99104
self.vertices = vertices
100105
self.reference_id = reference_id
101106
self.item_id = item_id
107+
self.annotation_id = annotation_id
102108
self.metadata = metadata if metadata else {}
103109

104110
@classmethod
@@ -109,6 +115,7 @@ def from_json(cls, payload: dict):
109115
vertices=geometry.get(VERTICES_KEY, []),
110116
reference_id=payload.get(REFERENCE_ID_KEY, None),
111117
item_id=payload.get(DATASET_ITEM_ID_KEY, None),
118+
annotation_id=payload.get(ANNOTATION_ID, None),
112119
metadata=payload.get(METADATA_KEY, {}),
113120
)
114121

@@ -118,6 +125,7 @@ def to_payload(self) -> dict:
118125
TYPE_KEY: POLYGON_TYPE,
119126
GEOMETRY_KEY: {VERTICES_KEY: self.vertices},
120127
REFERENCE_ID_KEY: self.reference_id,
128+
ANNOTATION_ID: self.annotation_id,
121129
METADATA_KEY: self.metadata,
122130
}
123131

nucleus/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
NUCLEUS_ENDPOINT = "https://api.scale.com/v1/nucleus"
1+
#NUCLEUS_ENDPOINT = "https://api.scale.com/v1/nucleus"
2+
NUCLEUS_ENDPOINT = "http://localhost:3000/v1/nucleus"
23
ITEMS_KEY = "items"
34
ITEM_KEY = "item"
45
REFERENCE_ID_KEY = "reference_id"

0 commit comments

Comments
 (0)