|
39 | 39 | "* Classification radio \n", |
40 | 40 | "* Classification checklist \n", |
41 | 41 | "* Classification free-form text \n", |
42 | | - "* Relationships (Only supported for MAL and through the SDK)\n", |
| 42 | + "\n", |
43 | 43 | "\n", |
44 | 44 | "**Not** supported:\n", |
| 45 | + "* Relationships\n", |
45 | 46 | "* Segmentation mask\n", |
46 | 47 | "* Polygon\n", |
47 | 48 | "* Bounding box \n", |
|
294 | 295 | "outputs": [], |
295 | 296 | "execution_count": null |
296 | 297 | }, |
297 | | - { |
298 | | - "metadata": {}, |
299 | | - "source": [ |
300 | | - "##### Relationship ##### \n", |
301 | | - "# only supported for MAL imports \n", |
302 | | - "ner_source = lb_types.ObjectAnnotation(\n", |
303 | | - " name=\"named_entity\",\n", |
304 | | - " value=lb_types.TextEntity(\n", |
305 | | - " start=133, \n", |
306 | | - " end=140\n", |
307 | | - " )\n", |
308 | | - ")\n", |
309 | | - "\n", |
310 | | - "ner_target = lb_types.ObjectAnnotation(\n", |
311 | | - " name=\"named_entity\",\n", |
312 | | - " value=lb_types.TextEntity(\n", |
313 | | - " start=143,\n", |
314 | | - " end=159\n", |
315 | | - " )\n", |
316 | | - ")\n", |
317 | | - "\n", |
318 | | - "ner_relationship = lb_types.RelationshipAnnotation(\n", |
319 | | - " name=\"relationship\",\n", |
320 | | - " value=lb_types.Relationship(\n", |
321 | | - " source=ner_source,\n", |
322 | | - " target=ner_target,\n", |
323 | | - " type=lb_types.Relationship.Type.UNIDIRECTIONAL,\n", |
324 | | - " ))\n", |
325 | | - "\n", |
326 | | - "\n", |
327 | | - "uuid_source = str(uuid.uuid4())\n", |
328 | | - "uuid_target = str(uuid.uuid4())\n", |
329 | | - "\n", |
330 | | - "entity_source_ndjson = {\n", |
331 | | - " \"name\": \"named_entity\",\n", |
332 | | - " \"uuid\": uuid_source,\n", |
333 | | - " \"location\": {\n", |
334 | | - " \"start\" : 133,\n", |
335 | | - " \"end\": 140 \n", |
336 | | - " }\n", |
337 | | - "}\n", |
338 | | - "\n", |
339 | | - "entity_target_ndjson = {\n", |
340 | | - " \"name\": \"named_entity\",\n", |
341 | | - " \"uuid\": uuid_target,\n", |
342 | | - " \"location\": {\n", |
343 | | - " \"start\": 143,\n", |
344 | | - " \"end\": 159\n", |
345 | | - " }\n", |
346 | | - "}\n", |
347 | | - "\n", |
348 | | - "ner_relationship_annotation_ndjson = {\n", |
349 | | - " \"name\": \"relationship\", \n", |
350 | | - " \"relationship\": {\n", |
351 | | - " \"source\": uuid_source,\n", |
352 | | - " \"target\": uuid_target,\n", |
353 | | - " \"type\": \"unidirectional\"\n", |
354 | | - " }\n", |
355 | | - "}" |
356 | | - ], |
357 | | - "cell_type": "code", |
358 | | - "outputs": [], |
359 | | - "execution_count": null |
360 | | - }, |
361 | 298 | { |
362 | 299 | "metadata": {}, |
363 | 300 | "source": [ |
|
472 | 409 | " tool=lb.Tool.Type.NER, \n", |
473 | 410 | " name=\"named_entity\"\n", |
474 | 411 | " ),\n", |
475 | | - " lb.Tool( \n", |
476 | | - " tool=lb.Tool.Type.RELATIONSHIP,\n", |
477 | | - " name=\"relationship\"\n", |
478 | | - " )\n", |
479 | 412 | " ]\n", |
480 | 413 | ")\n", |
481 | 414 | "\n", |
|
566 | 499 | " radio_annotation, \n", |
567 | 500 | " checklist_annotation, \n", |
568 | 501 | " text_annotation,\n", |
569 | | - " ner_source,\n", |
570 | | - " ner_target,\n", |
571 | | - " ner_relationship,\n", |
572 | 502 | " nested_checklist_annotation,\n", |
573 | 503 | " nested_radio_annotation\n", |
574 | 504 | " ]\n", |
|
596 | 526 | " text_annotation_ndjson,\n", |
597 | 527 | " nested_radio_annotation_ndjson,\n", |
598 | 528 | " nested_checklist_annotation_ndjson,\n", |
599 | | - " entity_source_ndjson,\n", |
600 | | - " entity_target_ndjson,\n", |
601 | | - " ner_relationship_annotation_ndjson,\n", |
602 | 529 | " ] :\n", |
603 | 530 | " annotations.update({\n", |
604 | 531 | " \"dataRow\": { \"globalKey\": global_key }\n", |
|
636 | 563 | " name=\"mal_import_job\"+str(uuid.uuid4()), \n", |
637 | 564 | " predictions=labels)\n", |
638 | 565 | "\n", |
639 | | - "upload_job_mal.wait_until_done();\n", |
| 566 | + "upload_job_mal.wait_until_done()\n", |
640 | 567 | "print(\"Errors:\", upload_job_mal.errors)\n", |
641 | 568 | "print(\"Status of uploads: \", upload_job_mal.statuses)" |
642 | 569 | ], |
|
654 | 581 | { |
655 | 582 | "metadata": {}, |
656 | 583 | "source": [ |
657 | | - "# Uncomment if relationships are not being imported. \n", |
658 | | - "# Relationships will be supported for label import in the near future. \n", |
659 | | - "\n", |
660 | | - "# # Upload label for this data row in project \n", |
661 | | - "# upload_job_label_import = lb.LabelImport.create_from_objects(\n", |
662 | | - "# client = client, \n", |
663 | | - "# project_id = project.uid, \n", |
664 | | - "# name=\"label_import_job\"+str(uuid.uuid4()), \n", |
665 | | - "# labels=labels)\n", |
| 584 | + "# Upload label for this data row in project \n", |
| 585 | + "upload_job_label_import = lb.LabelImport.create_from_objects(\n", |
| 586 | + " client = client, \n", |
| 587 | + " project_id = project.uid, \n", |
| 588 | + " name=\"label_import_job\"+str(uuid.uuid4()), \n", |
| 589 | + " labels=labels)\n", |
666 | 590 | "\n", |
667 | | - "# upload_job_label_import.wait_until_done();\n", |
668 | | - "# print(\"Errors:\", upload_job_label_import.errors)\n", |
669 | | - "# print(\"Status of uploads: \", upload_job_label_import.statuses)" |
| 591 | + "upload_job_label_import.wait_until_done()\n", |
| 592 | + "print(\"Errors:\", upload_job_label_import.errors)\n", |
| 593 | + "print(\"Status of uploads: \", upload_job_label_import.statuses)" |
670 | 594 | ], |
671 | 595 | "cell_type": "code", |
672 | 596 | "outputs": [], |
|
0 commit comments