Skip to content

Commit 9826e31

Browse files
kkim-labelboxwhistlerKevin KimVal Brodskyvbrodsky
authored
Release 3.45.0 (#1075)
Co-authored-by: Ibrahim Muhammad <[email protected]> Co-authored-by: Kevin Kim <[email protected]> Co-authored-by: Val Brodsky <[email protected]> Co-authored-by: Val Brodsky <[email protected]> Co-authored-by: Klaus Opreschko <[email protected]> Co-authored-by: Klaus Opreschko <[email protected]> Co-authored-by: mnoszczak <[email protected]> Co-authored-by: Andrea Ovalle <[email protected]> Co-authored-by: Dmitriy <[email protected]> Co-authored-by: Dmitriy Apollonin <[email protected]> Co-authored-by: Zeke <[email protected]> Co-authored-by: Richard Sun <[email protected]> Co-authored-by: Yamini Kancharana <[email protected]> Co-authored-by: Jovan Chohan <[email protected]> Co-authored-by: rahullb <[email protected]> Co-authored-by: rahul sharma <[email protected]> Co-authored-by: rahul sharma <[email protected]> Co-authored-by: ovalle15 <[email protected]>
1 parent 9631e4e commit 9826e31

File tree

10 files changed

+2202
-30
lines changed

10 files changed

+2202
-30
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
# Version 3.45.0 (2023-04-27)
4+
## Changed
5+
* Reduce threshold for async batch creation to 1000 data rows
6+
7+
## Notebooks
8+
* Added subclassifications to ontology notebook
9+
* Added conversational and pdf predictions notebooks
10+
311
# Version 3.44.0 (2023-04-26)
412

513
## Added

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
copyright = '2021, Labelbox'
2222
author = 'Labelbox'
2323

24-
release = '3.44.0'
24+
release = '3.45.0'
2525

2626
# -- General configuration ---------------------------------------------------
2727

examples/annotation_import/conversational.ipynb

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"* Classification Checklist \n",
4040
"* Classification Free Text \n",
4141
"* NER\n",
42+
"* Relationships (only supported for MAL imports)\n",
4243
"\n",
4344
"**Not** supported annotations\n",
4445
"\n",
@@ -125,13 +126,6 @@
125126
],
126127
"cell_type": "markdown"
127128
},
128-
{
129-
"metadata": {},
130-
"source": [
131-
"### NDJSON Annotations "
132-
],
133-
"cell_type": "markdown"
134-
},
135129
{
136130
"metadata": {},
137131
"source": [
@@ -302,6 +296,83 @@
302296
"outputs": [],
303297
"execution_count": null
304298
},
299+
{
300+
"metadata": {},
301+
"source": [
302+
"# ############ global nested classifications ###########\n",
303+
"# Message based\n",
304+
"nested_checklist_annotation = lb_types.ClassificationAnnotation(\n",
305+
" name=\"nested_checklist_question\",\n",
306+
" message_id=\"10\",\n",
307+
" value=lb_types.Checklist(\n",
308+
" answer=[lb_types.ClassificationAnswer(\n",
309+
" name=\"first_checklist_answer\",\n",
310+
" classifications=[\n",
311+
" lb_types.ClassificationAnnotation(\n",
312+
" name=\"sub_checklist_question\",\n",
313+
" value=lb_types.Checklist(\n",
314+
" answer=[lb_types.ClassificationAnswer(\n",
315+
" name=\"first_sub_checklist_answer\",\n",
316+
"\n",
317+
" )]\n",
318+
" ))\n",
319+
" ]\n",
320+
" )]\n",
321+
" )\n",
322+
")\n",
323+
"# Message based\n",
324+
"nested_checklist_annotation_ndjson = {\n",
325+
" \"name\": \"nested_checklist_question\",\n",
326+
" \"messageId\": \"10\",\n",
327+
" \"answer\": [{\n",
328+
" \"name\": \"first_checklist_answer\",\n",
329+
" \"classifications\" : [\n",
330+
" {\n",
331+
" \"name\": \"sub_checklist_question\", \n",
332+
" \"answer\": {\n",
333+
" \"name\": \"first_sub_checklist_answer\"\n",
334+
" }\n",
335+
" } \n",
336+
" ] \n",
337+
" }]\n",
338+
"}\n",
339+
"# Global\n",
340+
"nested_radio_annotation = lb_types.ClassificationAnnotation(\n",
341+
" name=\"nested_radio_question\",\n",
342+
" value=lb_types.Radio(\n",
343+
" answer=lb_types.ClassificationAnswer(\n",
344+
" name=\"first_radio_answer\",\n",
345+
" classifications=[\n",
346+
" lb_types.ClassificationAnnotation(\n",
347+
" name=\"sub_radio_question\",\n",
348+
" value=lb_types.Radio(\n",
349+
" answer=lb_types.ClassificationAnswer(\n",
350+
" name=\"first_sub_radio_answer\"\n",
351+
" )\n",
352+
" )\n",
353+
" )\n",
354+
" ]\n",
355+
" )\n",
356+
" )\n",
357+
")\n",
358+
"\n",
359+
"# Global\n",
360+
"nested_radio_annotation_ndjson = {\n",
361+
" \"name\": \"nested_radio_question\",\n",
362+
" \"answer\": {\n",
363+
" \"name\": \"first_radio_answer\",\n",
364+
" \"classifications\": [{\n",
365+
" \"name\":\"sub_radio_question\",\n",
366+
" \"answer\": { \"name\" : \"first_sub_radio_answer\"}\n",
367+
" }]\n",
368+
" }\n",
369+
"}\n",
370+
"\n"
371+
],
372+
"cell_type": "code",
373+
"outputs": [],
374+
"execution_count": null
375+
},
305376
{
306377
"metadata": {},
307378
"source": [
@@ -379,6 +450,36 @@
379450
" lb.Option(value=\"first_radio_answer\"),\n",
380451
" lb.Option(value=\"second_radio_answer\")\n",
381452
" ]\n",
453+
" ),\n",
454+
" lb.Classification(\n",
455+
" class_type=lb.Classification.Type.CHECKLIST,\n",
456+
" name=\"nested_checklist_question\",\n",
457+
" scope = lb.Classification.Scope.INDEX,\n",
458+
" options=[\n",
459+
" lb.Option(\"first_checklist_answer\",\n",
460+
" options=[\n",
461+
" lb.Classification(\n",
462+
" class_type=lb.Classification.Type.CHECKLIST,\n",
463+
" name=\"sub_checklist_question\", \n",
464+
" options=[lb.Option(\"first_sub_checklist_answer\")]\n",
465+
" )\n",
466+
" ])\n",
467+
" ]\n",
468+
" ),\n",
469+
" lb.Classification(\n",
470+
" class_type=lb.Classification.Type.RADIO,\n",
471+
" name=\"nested_radio_question\",\n",
472+
" scope = lb.Classification.Scope.GLOBAL,\n",
473+
" options=[\n",
474+
" lb.Option(\"first_radio_answer\",\n",
475+
" options=[\n",
476+
" lb.Classification(\n",
477+
" class_type=lb.Classification.Type.RADIO,\n",
478+
" name=\"sub_radio_question\",\n",
479+
" options=[lb.Option(\"first_sub_radio_answer\")]\n",
480+
" )\n",
481+
" ])\n",
482+
" ]\n",
382483
" )\n",
383484
" ]\n",
384485
")\n",
@@ -402,7 +503,7 @@
402503
"metadata": {},
403504
"source": [
404505
"# Create Labelbox project\n",
405-
"project = client.create_project(name=\"conversational_project\", \n",
506+
"project = client.create_project(name=\"Conversational Text Annotation Import Demo\", \n",
406507
" media_type=lb.MediaType.Conversational)\n",
407508
"\n",
408509
"# Setup your ontology \n",
@@ -471,7 +572,9 @@
471572
" radio_annotation,\n",
472573
" ner_source,\n",
473574
" ner_target,\n",
474-
" ner_relationship\n",
575+
" ner_relationship,\n",
576+
" nested_radio_annotation,\n",
577+
" nested_checklist_annotation\n",
475578
" ]\n",
476579
" )\n",
477580
")"
@@ -500,6 +603,8 @@
500603
" ner_source_ndjson,\n",
501604
" ner_target_ndjson,\n",
502605
" ner_relationship_annotation_ndjson,\n",
606+
" nested_checklist_annotation_ndjson,\n",
607+
" nested_radio_annotation_ndjson\n",
503608
" ]:\n",
504609
" annotations.update({\n",
505610
" \"dataRow\": {\n",

examples/basics/ontologies.ipynb

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
{
4444
"metadata": {},
4545
"source": [
46-
"!pip install labelbox"
46+
"!pip install labelbox -q"
4747
],
4848
"cell_type": "code",
4949
"outputs": [],
@@ -71,7 +71,7 @@
7171
"metadata": {},
7272
"source": [
7373
"# Add your api key\n",
74-
"API_KEY = None\n",
74+
"API_KEY = \"Enter api key here\"\n",
7575
"client = lb.Client(api_key=API_KEY)"
7676
],
7777
"cell_type": "code",
@@ -212,13 +212,41 @@
212212
{
213213
"metadata": {},
214214
"source": [
215-
"### Update and Delete\n",
216-
"- At this time, these options are not supported from the SDK.\n",
217-
"- Updating an ontology is dangerous and could cause labels to be hidden. \n",
218-
" - Use caution when doing so"
215+
"### Update and Delete"
219216
],
220217
"cell_type": "markdown"
221218
},
219+
{
220+
"metadata": {},
221+
"source": [
222+
"# Check if feature is archived\n",
223+
"feature_schema = next(client.get_feature_schemas(\"cat\"))\n",
224+
"client.is_feature_schema_archived(ontology_id=ontology.uid, feature_schema_id=feature_schema.uid)"
225+
],
226+
"cell_type": "code",
227+
"outputs": [],
228+
"execution_count": null
229+
},
230+
{
231+
"metadata": {},
232+
"source": [
233+
"Delete or Archived a feature:\n",
234+
"\n",
235+
"If the feature schema is a root level node with associated labels, it will be archived.\n",
236+
"If the feature schema is a nested node in the ontology and does not have associated labels, it will be deleted.\n",
237+
"If the feature schema is a nested node in the ontology and has associated labels, it will not be deleted."
238+
],
239+
"cell_type": "markdown"
240+
},
241+
{
242+
"metadata": {},
243+
"source": [
244+
"client.delete_feature_schema_from_ontology(ontology_id=ontology.uid, feature_schema_id=feature_schema.uid)"
245+
],
246+
"cell_type": "code",
247+
"outputs": [],
248+
"execution_count": null
249+
},
222250
{
223251
"metadata": {},
224252
"source": [
@@ -286,12 +314,12 @@
286314
" name=\"cat\",\n",
287315
" classifications=[\n",
288316
" lb.Classification(class_type=lb.Classification.Type.TEXT,\n",
289-
" instructions=\"name\")\n",
317+
" name=\"name\")\n",
290318
" ])\n",
291319
" ],\n",
292320
" classifications=[\n",
293321
" lb.Classification(class_type=lb.Classification.Type.RADIO,\n",
294-
" instructions=\"image_quality\",\n",
322+
" name=\"image_quality\",\n",
295323
" options=[lb.Option(value=\"clear\"),\n",
296324
" lb.Option(value=\"blurry\")])\n",
297325
" ])\n",
@@ -301,6 +329,35 @@
301329
"outputs": [],
302330
"execution_count": null
303331
},
332+
{
333+
"metadata": {},
334+
"source": [
335+
"Example of how to add sub-classfication within an option"
336+
],
337+
"cell_type": "markdown"
338+
},
339+
{
340+
"metadata": {},
341+
"source": [
342+
"# We will use add_classification to add this classification to a previously built ontology_builder or you can create new ontology_builder = OntologyBuilder() \n",
343+
"radio_classification = lb.Classification(class_type=lb.Classification.Type.RADIO,\n",
344+
" name=\"Global classification\",\n",
345+
" options=[lb.Option(\"1st option\", options=[lb.Classification(class_type=lb.Classification.Type.CHECKLIST,\n",
346+
" name=\"Inside 1st option\",\n",
347+
" options=[lb.Option(\"Option A\"), lb.Option(\"Option B\")])]), lb.Option(\"2nd option\", options=[lb.Classification(class_type=lb.Classification.Type.CHECKLIST,\n",
348+
" name=\"Inside 2nd option\",\n",
349+
" options=[lb.Option(\"Option A\"), lb.Option(\"Option B\")])])])\n",
350+
"\n",
351+
"ontology_builder.add_classification(radio_classification) \n",
352+
"\n",
353+
"ontology = client.create_ontology(\"example of nested classification\",\n",
354+
" ontology_builder.asdict())\n",
355+
"print(json.dumps(ontology.normalized, indent=2))"
356+
],
357+
"cell_type": "code",
358+
"outputs": [],
359+
"execution_count": null
360+
},
304361
{
305362
"metadata": {},
306363
"source": [
@@ -335,13 +392,13 @@
335392
"metadata": {},
336393
"source": [
337394
"text_classification = lb.Classification(class_type=lb.Classification.Type.TEXT,\n",
338-
" instructions=\"dog_name\")\n",
395+
" name=\"dog_name\")\n",
339396
"radio_classification = lb.Classification(class_type=lb.Classification.Type.RADIO,\n",
340-
" instructions=\"dog_breed\",\n",
397+
" name=\"dog_breed\",\n",
341398
" options=[lb.Option(\"poodle\")])\n",
342399
"checklist_classification = lb.Classification(\n",
343400
" class_type=lb.Classification.Type.CHECKLIST,\n",
344-
" instructions=\"background\",\n",
401+
" name=\"background\",\n",
345402
" options=[lb.Option(\"at_park\"), lb.Option(\"has_leash\")])"
346403
],
347404
"cell_type": "code",

0 commit comments

Comments
 (0)