Skip to content

Commit a03be0e

Browse files
committed
removal of endpoint too
1 parent 9ec85f1 commit a03be0e

28 files changed

+334
-98
lines changed

examples/annotation_types/basics.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@
105105
"source": [
106106
"# Add your api key\n",
107107
"API_KEY = None\n",
108-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
109-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
108+
"client = Client(api_key=API_KEY)"
110109
]
111110
},
112111
{

examples/annotation_types/converters.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@
8383
"source": [
8484
"# Add your api key\n",
8585
"API_KEY = None\n",
86-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
87-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
86+
"client = Client(api_key=API_KEY)"
8887
]
8988
},
9089
{

examples/annotation_types/label_containers.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@
8080
"source": [
8181
"# Add your api key\n",
8282
"API_KEY = None\n",
83-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
84-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
83+
"client = Client(api_key=API_KEY)"
8584
]
8685
},
8786
{

examples/annotation_types/mal_using_annotation_types.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@
102102
"source": [
103103
"# Add your api key\n",
104104
"API_KEY = None\n",
105-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
106-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
105+
"client = Client(api_key=API_KEY)"
107106
]
108107
},
109108
{

examples/basics/basics.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@
134134
"source": [
135135
"# Add your api key\n",
136136
"API_KEY = None\n",
137-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
138-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
137+
"client = Client(api_key=API_KEY)"
139138
]
140139
},
141140
{

examples/basics/data_row_metadata.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@
112112
"source": [
113113
"# Add your api key\n",
114114
"API_KEY = None\n",
115-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
116-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
115+
"client = Client(api_key=API_KEY)"
117116
]
118117
},
119118
{

examples/basics/data_rows.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@
9393
"source": [
9494
"# Add your api key\n",
9595
"API_KEY = None\n",
96-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
97-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
96+
"client = Client(api_key=API_KEY)"
9897
]
9998
},
10099
{

examples/basics/datasets.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@
9797
"source": [
9898
"# Add your api key\n",
9999
"API_KEY = None\n",
100-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
101-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
100+
"client = Client(api_key=API_KEY)"
102101
]
103102
},
104103
{

examples/basics/labels.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@
9494
"source": [
9595
"# Add your api key\n",
9696
"API_KEY = None\n",
97-
"ENDPOINT = \"https://api.labelbox.com/graphql\"\n",
98-
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)\n",
97+
"client = Client(api_key=API_KEY)\n",
9998
"project = client.get_project(PROJECT_ID)"
10099
]
101100
},

examples/basics/ontologies.ipynb

Lines changed: 131 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
"scrolled": true
4949
},
5050
"outputs": [],
51-
"source": "!pip install labelbox"
51+
"source": [
52+
"!pip install labelbox"
53+
]
5254
},
5355
{
5456
"cell_type": "code",
@@ -58,7 +60,10 @@
5860
"scrolled": true
5961
},
6062
"outputs": [],
61-
"source": "from labelbox import Client, OntologyBuilder, Tool, Classification, Option\nimport json"
63+
"source": [
64+
"from labelbox import Client, OntologyBuilder, Tool, Classification, Option\n",
65+
"import json"
66+
]
6267
},
6368
{
6469
"cell_type": "code",
@@ -68,7 +73,11 @@
6873
"scrolled": true
6974
},
7075
"outputs": [],
71-
"source": "# Add your api key\nAPI_KEY = None\nENDPOINT = \"https://api.labelbox.com/graphql\"\nclient = Client(api_key=API_KEY, endpoint=ENDPOINT)"
76+
"source": [
77+
"# Add your api key\n",
78+
"API_KEY = None\n",
79+
"client = Client(api_key=API_KEY)"
80+
]
7281
},
7382
{
7483
"cell_type": "markdown",
@@ -88,7 +97,23 @@
8897
"scrolled": true
8998
},
9099
"outputs": [],
91-
"source": "# This will automatically create new feature schema\nontology_name = \"sdk-ontology\"\nfeature_schema_cat_normalized = {\n 'tool': 'polygon',\n 'name': 'cat',\n 'color': 'black'\n}\n\nontology_normalized_json = {\n \"tools\": [feature_schema_cat_normalized],\n \"classifications\": []\n}\nontology = client.create_ontology(name=ontology_name,\n normalized=ontology_normalized_json)\nprint(ontology)"
100+
"source": [
101+
"# This will automatically create new feature schema\n",
102+
"ontology_name = \"sdk-ontology\"\n",
103+
"feature_schema_cat_normalized = {\n",
104+
" 'tool': 'polygon',\n",
105+
" 'name': 'cat',\n",
106+
" 'color': 'black'\n",
107+
"}\n",
108+
"\n",
109+
"ontology_normalized_json = {\n",
110+
" \"tools\": [feature_schema_cat_normalized],\n",
111+
" \"classifications\": []\n",
112+
"}\n",
113+
"ontology = client.create_ontology(name=ontology_name,\n",
114+
" normalized=ontology_normalized_json)\n",
115+
"print(ontology)"
116+
]
92117
},
93118
{
94119
"cell_type": "markdown",
@@ -108,7 +133,14 @@
108133
"scrolled": true
109134
},
110135
"outputs": [],
111-
"source": "# First create the feature schema\nfeature_schema_cat = client.create_feature_schema(feature_schema_cat_normalized)\n# When we create the ontology it will not re-create the feature schema\nprint(feature_schema_cat.uid)\nontology = client.create_ontology_from_feature_schemas(ontology_name,\n [feature_schema_cat.uid])"
136+
"source": [
137+
"# First create the feature schema\n",
138+
"feature_schema_cat = client.create_feature_schema(feature_schema_cat_normalized)\n",
139+
"# When we create the ontology it will not re-create the feature schema\n",
140+
"print(feature_schema_cat.uid)\n",
141+
"ontology = client.create_ontology_from_feature_schemas(ontology_name,\n",
142+
" [feature_schema_cat.uid])"
143+
]
112144
},
113145
{
114146
"cell_type": "markdown",
@@ -129,7 +161,20 @@
129161
"scrolled": true
130162
},
131163
"outputs": [],
132-
"source": "# Create new dog schema id\nfeature_schema_dog_normalized = {\n 'tool': 'polygon',\n 'name': 'dog',\n 'color': 'black',\n 'classifications': [],\n}\nfeature_schema_dog = client.create_feature_schema(feature_schema_dog_normalized)\n# The cat is shared between this new ontology and the one we created previously\n# (ie. the cat feature schema will not be re-created)\nontology = client.create_ontology_from_feature_schemas(\n ontology_name, [feature_schema_cat.uid, feature_schema_dog.uid])"
164+
"source": [
165+
"# Create new dog schema id\n",
166+
"feature_schema_dog_normalized = {\n",
167+
" 'tool': 'polygon',\n",
168+
" 'name': 'dog',\n",
169+
" 'color': 'black',\n",
170+
" 'classifications': [],\n",
171+
"}\n",
172+
"feature_schema_dog = client.create_feature_schema(feature_schema_dog_normalized)\n",
173+
"# The cat is shared between this new ontology and the one we created previously\n",
174+
"# (ie. the cat feature schema will not be re-created)\n",
175+
"ontology = client.create_ontology_from_feature_schemas(\n",
176+
" ontology_name, [feature_schema_cat.uid, feature_schema_dog.uid])"
177+
]
133178
},
134179
{
135180
"cell_type": "markdown",
@@ -149,7 +194,13 @@
149194
"scrolled": true
150195
},
151196
"outputs": [],
152-
"source": "#### Fetch by ID\nfeature_schema = client.get_feature_schema(feature_schema_cat.uid)\nontology = client.get_ontology(ontology.uid)\nprint(feature_schema)\nprint(ontology)"
197+
"source": [
198+
"#### Fetch by ID\n",
199+
"feature_schema = client.get_feature_schema(feature_schema_cat.uid)\n",
200+
"ontology = client.get_ontology(ontology.uid)\n",
201+
"print(feature_schema)\n",
202+
"print(ontology)"
203+
]
153204
},
154205
{
155206
"cell_type": "code",
@@ -159,7 +210,13 @@
159210
"scrolled": true
160211
},
161212
"outputs": [],
162-
"source": "#### Search by name\nfeature_schema = next(client.get_feature_schemas(\"cat\"))\nontology = next(client.get_ontologies(ontology_name))\nprint(feature_schema)\nprint(ontology)"
213+
"source": [
214+
"#### Search by name\n",
215+
"feature_schema = next(client.get_feature_schemas(\"cat\"))\n",
216+
"ontology = next(client.get_ontologies(ontology_name))\n",
217+
"print(feature_schema)\n",
218+
"print(ontology)"
219+
]
163220
},
164221
{
165222
"cell_type": "markdown",
@@ -189,7 +246,17 @@
189246
"scrolled": true
190247
},
191248
"outputs": [],
192-
"source": "# Create normalized json with a bounding box and segmentation tool\nontology_builder = OntologyBuilder(tools=[\n Tool(tool=Tool.Type.BBOX, name=\"dog\"),\n Tool(tool=Tool.Type.SEGMENTATION, name=\"cat\"),\n])\n# Creating an ontology from this is easy\nontology = client.create_ontology(\"ontology-builder-ontology\",\n ontology_builder.asdict())\nprint(json.dumps(ontology.normalized, indent=2))"
249+
"source": [
250+
"# Create normalized json with a bounding box and segmentation tool\n",
251+
"ontology_builder = OntologyBuilder(tools=[\n",
252+
" Tool(tool=Tool.Type.BBOX, name=\"dog\"),\n",
253+
" Tool(tool=Tool.Type.SEGMENTATION, name=\"cat\"),\n",
254+
"])\n",
255+
"# Creating an ontology from this is easy\n",
256+
"ontology = client.create_ontology(\"ontology-builder-ontology\",\n",
257+
" ontology_builder.asdict())\n",
258+
"print(json.dumps(ontology.normalized, indent=2))"
259+
]
193260
},
194261
{
195262
"cell_type": "markdown",
@@ -207,7 +274,18 @@
207274
"scrolled": true
208275
},
209276
"outputs": [],
210-
"source": "# Create\nontology_builder = OntologyBuilder()\n# Append tools\ntool_dog = Tool(tool=Tool.Type.BBOX, name=\"dog\")\ntool_cat = Tool(tool=Tool.Type.SEGMENTATION, name=\"cat\")\nontology_builder.add_tool(tool_dog)\nontology_builder.add_tool(tool_cat)\nontology = client.create_ontology(\"ontology-builder-ontology\",\n ontology_builder.asdict())\nprint(json.dumps(ontology.normalized, indent=2))"
277+
"source": [
278+
"# Create\n",
279+
"ontology_builder = OntologyBuilder()\n",
280+
"# Append tools\n",
281+
"tool_dog = Tool(tool=Tool.Type.BBOX, name=\"dog\")\n",
282+
"tool_cat = Tool(tool=Tool.Type.SEGMENTATION, name=\"cat\")\n",
283+
"ontology_builder.add_tool(tool_dog)\n",
284+
"ontology_builder.add_tool(tool_cat)\n",
285+
"ontology = client.create_ontology(\"ontology-builder-ontology\",\n",
286+
" ontology_builder.asdict())\n",
287+
"print(json.dumps(ontology.normalized, indent=2))"
288+
]
211289
},
212290
{
213291
"cell_type": "markdown",
@@ -225,7 +303,25 @@
225303
"scrolled": true
226304
},
227305
"outputs": [],
228-
"source": "ontology_builder = OntologyBuilder(\n tools=[\n Tool(tool=Tool.Type.BBOX, name=\"dog\"),\n Tool(tool=Tool.Type.SEGMENTATION,\n name=\"cat\",\n classifications=[\n Classification(class_type=Classification.Type.TEXT,\n instructions=\"name\")\n ])\n ],\n classifications=[\n Classification(class_type=Classification.Type.RADIO,\n instructions=\"image_quality\",\n options=[Option(value=\"clear\"),\n Option(value=\"blurry\")])\n ])\nprint(json.dumps(ontology_builder.asdict(), indent=2))"
306+
"source": [
307+
"ontology_builder = OntologyBuilder(\n",
308+
" tools=[\n",
309+
" Tool(tool=Tool.Type.BBOX, name=\"dog\"),\n",
310+
" Tool(tool=Tool.Type.SEGMENTATION,\n",
311+
" name=\"cat\",\n",
312+
" classifications=[\n",
313+
" Classification(class_type=Classification.Type.TEXT,\n",
314+
" instructions=\"name\")\n",
315+
" ])\n",
316+
" ],\n",
317+
" classifications=[\n",
318+
" Classification(class_type=Classification.Type.RADIO,\n",
319+
" instructions=\"image_quality\",\n",
320+
" options=[Option(value=\"clear\"),\n",
321+
" Option(value=\"blurry\")])\n",
322+
" ])\n",
323+
"print(json.dumps(ontology_builder.asdict(), indent=2))"
324+
]
229325
},
230326
{
231327
"cell_type": "markdown",
@@ -243,7 +339,14 @@
243339
"scrolled": true
244340
},
245341
"outputs": [],
246-
"source": "bbox_tool = Tool(tool=Tool.Type.BBOX, name=\"dog_box\")\npoly_tool = Tool(tool=Tool.Type.POLYGON, name=\"dog_poly\")\nseg_tool = Tool(tool=Tool.Type.SEGMENTATION, name=\"dog_seg\")\npoint_tool = Tool(tool=Tool.Type.POINT, name=\"dog_center\")\nline_tool = Tool(tool=Tool.Type.LINE, name=\"dog_orientation\")\nner_tool = Tool(tool=Tool.Type.NER, name=\"dog_reference\")"
342+
"source": [
343+
"bbox_tool = Tool(tool=Tool.Type.BBOX, name=\"dog_box\")\n",
344+
"poly_tool = Tool(tool=Tool.Type.POLYGON, name=\"dog_poly\")\n",
345+
"seg_tool = Tool(tool=Tool.Type.SEGMENTATION, name=\"dog_seg\")\n",
346+
"point_tool = Tool(tool=Tool.Type.POINT, name=\"dog_center\")\n",
347+
"line_tool = Tool(tool=Tool.Type.LINE, name=\"dog_orientation\")\n",
348+
"ner_tool = Tool(tool=Tool.Type.NER, name=\"dog_reference\")"
349+
]
247350
},
248351
{
249352
"cell_type": "markdown",
@@ -262,7 +365,21 @@
262365
"scrolled": true
263366
},
264367
"outputs": [],
265-
"source": "text_classification = Classification(class_type=Classification.Type.TEXT,\n instructions=\"dog_name\")\nradio_classification = Classification(class_type=Classification.Type.CHECKLIST,\n instructions=\"dog_breed\",\n options=[Option(\"poodle\")])\ndropdown_classification = Classification(\n class_type=Classification.Type.DROPDOWN,\n instructions=\"dog_features\",\n options=[Option(\"short\"), Option(\"fluffy\")])\nchecklist_classification = Classification(\n class_type=Classification.Type.CHECKLIST,\n instructions=\"background\",\n options=[Option(\"at_park\"), Option(\"has_leash\")])"
368+
"source": [
369+
"text_classification = Classification(class_type=Classification.Type.TEXT,\n",
370+
" instructions=\"dog_name\")\n",
371+
"radio_classification = Classification(class_type=Classification.Type.CHECKLIST,\n",
372+
" instructions=\"dog_breed\",\n",
373+
" options=[Option(\"poodle\")])\n",
374+
"dropdown_classification = Classification(\n",
375+
" class_type=Classification.Type.DROPDOWN,\n",
376+
" instructions=\"dog_features\",\n",
377+
" options=[Option(\"short\"), Option(\"fluffy\")])\n",
378+
"checklist_classification = Classification(\n",
379+
" class_type=Classification.Type.CHECKLIST,\n",
380+
" instructions=\"background\",\n",
381+
" options=[Option(\"at_park\"), Option(\"has_leash\")])"
382+
]
266383
}
267384
],
268385
"metadata": {
@@ -286,4 +403,4 @@
286403
},
287404
"nbformat": 4,
288405
"nbformat_minor": 5
289-
}
406+
}

0 commit comments

Comments
 (0)