Skip to content

Commit

Permalink
Release 3.45.0 (#1075)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
19 people authored Apr 27, 2023
1 parent 9631e4e commit 9826e31
Show file tree
Hide file tree
Showing 10 changed files with 2,202 additions and 30 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# Version 3.45.0 (2023-04-27)
## Changed
* Reduce threshold for async batch creation to 1000 data rows

## Notebooks
* Added subclassifications to ontology notebook
* Added conversational and pdf predictions notebooks

# Version 3.44.0 (2023-04-26)

## Added
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
copyright = '2021, Labelbox'
author = 'Labelbox'

release = '3.44.0'
release = '3.45.0'

# -- General configuration ---------------------------------------------------

Expand Down
123 changes: 114 additions & 9 deletions examples/annotation_import/conversational.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"* Classification Checklist \n",
"* Classification Free Text \n",
"* NER\n",
"* Relationships (only supported for MAL imports)\n",
"\n",
"**Not** supported annotations\n",
"\n",
Expand Down Expand Up @@ -125,13 +126,6 @@
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
"### NDJSON Annotations "
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
Expand Down Expand Up @@ -302,6 +296,83 @@
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
"# ############ global nested classifications ###########\n",
"# Message based\n",
"nested_checklist_annotation = lb_types.ClassificationAnnotation(\n",
" name=\"nested_checklist_question\",\n",
" message_id=\"10\",\n",
" value=lb_types.Checklist(\n",
" answer=[lb_types.ClassificationAnswer(\n",
" name=\"first_checklist_answer\",\n",
" classifications=[\n",
" lb_types.ClassificationAnnotation(\n",
" name=\"sub_checklist_question\",\n",
" value=lb_types.Checklist(\n",
" answer=[lb_types.ClassificationAnswer(\n",
" name=\"first_sub_checklist_answer\",\n",
"\n",
" )]\n",
" ))\n",
" ]\n",
" )]\n",
" )\n",
")\n",
"# Message based\n",
"nested_checklist_annotation_ndjson = {\n",
" \"name\": \"nested_checklist_question\",\n",
" \"messageId\": \"10\",\n",
" \"answer\": [{\n",
" \"name\": \"first_checklist_answer\",\n",
" \"classifications\" : [\n",
" {\n",
" \"name\": \"sub_checklist_question\", \n",
" \"answer\": {\n",
" \"name\": \"first_sub_checklist_answer\"\n",
" }\n",
" } \n",
" ] \n",
" }]\n",
"}\n",
"# Global\n",
"nested_radio_annotation = lb_types.ClassificationAnnotation(\n",
" name=\"nested_radio_question\",\n",
" value=lb_types.Radio(\n",
" answer=lb_types.ClassificationAnswer(\n",
" name=\"first_radio_answer\",\n",
" classifications=[\n",
" lb_types.ClassificationAnnotation(\n",
" name=\"sub_radio_question\",\n",
" value=lb_types.Radio(\n",
" answer=lb_types.ClassificationAnswer(\n",
" name=\"first_sub_radio_answer\"\n",
" )\n",
" )\n",
" )\n",
" ]\n",
" )\n",
" )\n",
")\n",
"\n",
"# Global\n",
"nested_radio_annotation_ndjson = {\n",
" \"name\": \"nested_radio_question\",\n",
" \"answer\": {\n",
" \"name\": \"first_radio_answer\",\n",
" \"classifications\": [{\n",
" \"name\":\"sub_radio_question\",\n",
" \"answer\": { \"name\" : \"first_sub_radio_answer\"}\n",
" }]\n",
" }\n",
"}\n",
"\n"
],
"cell_type": "code",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
Expand Down Expand Up @@ -379,6 +450,36 @@
" lb.Option(value=\"first_radio_answer\"),\n",
" lb.Option(value=\"second_radio_answer\")\n",
" ]\n",
" ),\n",
" lb.Classification(\n",
" class_type=lb.Classification.Type.CHECKLIST,\n",
" name=\"nested_checklist_question\",\n",
" scope = lb.Classification.Scope.INDEX,\n",
" options=[\n",
" lb.Option(\"first_checklist_answer\",\n",
" options=[\n",
" lb.Classification(\n",
" class_type=lb.Classification.Type.CHECKLIST,\n",
" name=\"sub_checklist_question\", \n",
" options=[lb.Option(\"first_sub_checklist_answer\")]\n",
" )\n",
" ])\n",
" ]\n",
" ),\n",
" lb.Classification(\n",
" class_type=lb.Classification.Type.RADIO,\n",
" name=\"nested_radio_question\",\n",
" scope = lb.Classification.Scope.GLOBAL,\n",
" options=[\n",
" lb.Option(\"first_radio_answer\",\n",
" options=[\n",
" lb.Classification(\n",
" class_type=lb.Classification.Type.RADIO,\n",
" name=\"sub_radio_question\",\n",
" options=[lb.Option(\"first_sub_radio_answer\")]\n",
" )\n",
" ])\n",
" ]\n",
" )\n",
" ]\n",
")\n",
Expand All @@ -402,7 +503,7 @@
"metadata": {},
"source": [
"# Create Labelbox project\n",
"project = client.create_project(name=\"conversational_project\", \n",
"project = client.create_project(name=\"Conversational Text Annotation Import Demo\", \n",
" media_type=lb.MediaType.Conversational)\n",
"\n",
"# Setup your ontology \n",
Expand Down Expand Up @@ -471,7 +572,9 @@
" radio_annotation,\n",
" ner_source,\n",
" ner_target,\n",
" ner_relationship\n",
" ner_relationship,\n",
" nested_radio_annotation,\n",
" nested_checklist_annotation\n",
" ]\n",
" )\n",
")"
Expand Down Expand Up @@ -500,6 +603,8 @@
" ner_source_ndjson,\n",
" ner_target_ndjson,\n",
" ner_relationship_annotation_ndjson,\n",
" nested_checklist_annotation_ndjson,\n",
" nested_radio_annotation_ndjson\n",
" ]:\n",
" annotations.update({\n",
" \"dataRow\": {\n",
Expand Down
79 changes: 68 additions & 11 deletions examples/basics/ontologies.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
"metadata": {},
"source": [
"!pip install labelbox"
"!pip install labelbox -q"
],
"cell_type": "code",
"outputs": [],
Expand Down Expand Up @@ -71,7 +71,7 @@
"metadata": {},
"source": [
"# Add your api key\n",
"API_KEY = None\n",
"API_KEY = \"Enter api key here\"\n",
"client = lb.Client(api_key=API_KEY)"
],
"cell_type": "code",
Expand Down Expand Up @@ -212,13 +212,41 @@
{
"metadata": {},
"source": [
"### Update and Delete\n",
"- At this time, these options are not supported from the SDK.\n",
"- Updating an ontology is dangerous and could cause labels to be hidden. \n",
" - Use caution when doing so"
"### Update and Delete"
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
"# Check if feature is archived\n",
"feature_schema = next(client.get_feature_schemas(\"cat\"))\n",
"client.is_feature_schema_archived(ontology_id=ontology.uid, feature_schema_id=feature_schema.uid)"
],
"cell_type": "code",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
"Delete or Archived a feature:\n",
"\n",
"If the feature schema is a root level node with associated labels, it will be archived.\n",
"If the feature schema is a nested node in the ontology and does not have associated labels, it will be deleted.\n",
"If the feature schema is a nested node in the ontology and has associated labels, it will not be deleted."
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
"client.delete_feature_schema_from_ontology(ontology_id=ontology.uid, feature_schema_id=feature_schema.uid)"
],
"cell_type": "code",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
Expand Down Expand Up @@ -286,12 +314,12 @@
" name=\"cat\",\n",
" classifications=[\n",
" lb.Classification(class_type=lb.Classification.Type.TEXT,\n",
" instructions=\"name\")\n",
" name=\"name\")\n",
" ])\n",
" ],\n",
" classifications=[\n",
" lb.Classification(class_type=lb.Classification.Type.RADIO,\n",
" instructions=\"image_quality\",\n",
" name=\"image_quality\",\n",
" options=[lb.Option(value=\"clear\"),\n",
" lb.Option(value=\"blurry\")])\n",
" ])\n",
Expand All @@ -301,6 +329,35 @@
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
"Example of how to add sub-classfication within an option"
],
"cell_type": "markdown"
},
{
"metadata": {},
"source": [
"# We will use add_classification to add this classification to a previously built ontology_builder or you can create new ontology_builder = OntologyBuilder() \n",
"radio_classification = lb.Classification(class_type=lb.Classification.Type.RADIO,\n",
" name=\"Global classification\",\n",
" options=[lb.Option(\"1st option\", options=[lb.Classification(class_type=lb.Classification.Type.CHECKLIST,\n",
" name=\"Inside 1st option\",\n",
" options=[lb.Option(\"Option A\"), lb.Option(\"Option B\")])]), lb.Option(\"2nd option\", options=[lb.Classification(class_type=lb.Classification.Type.CHECKLIST,\n",
" name=\"Inside 2nd option\",\n",
" options=[lb.Option(\"Option A\"), lb.Option(\"Option B\")])])])\n",
"\n",
"ontology_builder.add_classification(radio_classification) \n",
"\n",
"ontology = client.create_ontology(\"example of nested classification\",\n",
" ontology_builder.asdict())\n",
"print(json.dumps(ontology.normalized, indent=2))"
],
"cell_type": "code",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"source": [
Expand Down Expand Up @@ -335,13 +392,13 @@
"metadata": {},
"source": [
"text_classification = lb.Classification(class_type=lb.Classification.Type.TEXT,\n",
" instructions=\"dog_name\")\n",
" name=\"dog_name\")\n",
"radio_classification = lb.Classification(class_type=lb.Classification.Type.RADIO,\n",
" instructions=\"dog_breed\",\n",
" name=\"dog_breed\",\n",
" options=[lb.Option(\"poodle\")])\n",
"checklist_classification = lb.Classification(\n",
" class_type=lb.Classification.Type.CHECKLIST,\n",
" instructions=\"background\",\n",
" name=\"background\",\n",
" options=[lb.Option(\"at_park\"), lb.Option(\"has_leash\")])"
],
"cell_type": "code",
Expand Down
Loading

0 comments on commit 9826e31

Please sign in to comment.