Skip to content

Commit 70673af

Browse files
authored
fix issues with ndjson composite mask (#1441)
Fix some issues with composite mask examples
1 parent c517312 commit 70673af

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

examples/annotation_import/image.ipynb

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
{
109109
"metadata": {},
110110
"source": [
111-
"API_KEY = \"\"\n",
111+
"API_KEY =\"\"\n",
112112
"client = lb.Client(API_KEY)"
113113
],
114114
"cell_type": "code",
@@ -569,41 +569,17 @@
569569
" )\n",
570570
"\n",
571571
"\n",
572-
"# NDJSON using instanceURI, or bytes array - use one of the two options\n",
572+
"# NDJSON using bytes array\n",
573573
"cp_mask_ndjson = []\n",
574574
"\n",
575-
"for color in colors:\n",
576-
" if color in rgb_colors_for_mask_with_text_subclass_tool:\n",
577-
" cp_mask_ndjson.append({\n",
578-
" \"name\": \"mask_with_text_subclass\",\n",
579-
" \"mask\": {\"instanceURI\": cp_mask_url,\n",
580-
" \"colorRGB\": color },\n",
581-
" \"classifications\":[{\n",
582-
" \"name\": \"sub_free_text\",\n",
583-
" \"answer\": \"free text answer\"\n",
584-
" }]\n",
585-
" }\n",
586-
" )\n",
587-
" else:\n",
588-
" cp_mask_ndjson.append({\n",
589-
" \"name\": \"mask\",\n",
590-
" \"classifications\": [],\n",
591-
" \"mask\": {\n",
592-
" \"instanceURI\": cp_mask_url,\n",
593-
" \"colorRGB\": color\n",
594-
" }\n",
595-
" }\n",
596-
" )\n",
597-
"\n",
598-
"\n",
599575
"#Using bytes array.\n",
600576
"response = requests.get(cp_mask_url)\n",
601577
"im_bytes = base64.b64encode(response.content).decode('utf-8')\n",
602578
"for color in colors:\n",
603579
" if color in rgb_colors_for_mask_with_text_subclass_tool:\n",
604580
" cp_mask_ndjson.append({\n",
605581
" \"name\": \"mask_with_text_subclass\",\n",
606-
" \"mask\": {\"instanceURI\": im_bytes,\n",
582+
" \"mask\": {\"imBytes\": im_bytes,\n",
607583
" \"colorRGB\": color },\n",
608584
" \"classifications\":[{\n",
609585
" \"name\": \"sub_free_text\",\n",
@@ -616,7 +592,7 @@
616592
" \"name\": \"mask\",\n",
617593
" \"classifications\": [],\n",
618594
" \"mask\": {\n",
619-
" \"instanceURI\": im_bytes,\n",
595+
" \"imBytes\": im_bytes,\n",
620596
" \"colorRGB\": color\n",
621597
" }\n",
622598
" }\n",

0 commit comments

Comments
 (0)