|
108 | 108 | { |
109 | 109 | "metadata": {}, |
110 | 110 | "source": [ |
111 | | - "API_KEY = \"\"\n", |
| 111 | + "API_KEY =\"\"\n", |
112 | 112 | "client = lb.Client(API_KEY)" |
113 | 113 | ], |
114 | 114 | "cell_type": "code", |
|
569 | 569 | " )\n", |
570 | 570 | "\n", |
571 | 571 | "\n", |
572 | | - "# NDJSON using instanceURI, or bytes array - use one of the two options\n", |
| 572 | + "# NDJSON using bytes array\n", |
573 | 573 | "cp_mask_ndjson = []\n", |
574 | 574 | "\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", |
599 | 575 | "#Using bytes array.\n", |
600 | 576 | "response = requests.get(cp_mask_url)\n", |
601 | 577 | "im_bytes = base64.b64encode(response.content).decode('utf-8')\n", |
602 | 578 | "for color in colors:\n", |
603 | 579 | " if color in rgb_colors_for_mask_with_text_subclass_tool:\n", |
604 | 580 | " cp_mask_ndjson.append({\n", |
605 | 581 | " \"name\": \"mask_with_text_subclass\",\n", |
606 | | - " \"mask\": {\"instanceURI\": im_bytes,\n", |
| 582 | + " \"mask\": {\"imBytes\": im_bytes,\n", |
607 | 583 | " \"colorRGB\": color },\n", |
608 | 584 | " \"classifications\":[{\n", |
609 | 585 | " \"name\": \"sub_free_text\",\n", |
|
616 | 592 | " \"name\": \"mask\",\n", |
617 | 593 | " \"classifications\": [],\n", |
618 | 594 | " \"mask\": {\n", |
619 | | - " \"instanceURI\": im_bytes,\n", |
| 595 | + " \"imBytes\": im_bytes,\n", |
620 | 596 | " \"colorRGB\": color\n", |
621 | 597 | " }\n", |
622 | 598 | " }\n", |
|
0 commit comments