|
115 | 115 | "client = lb.Client(api_key=API_KEY)"
|
116 | 116 | ],
|
117 | 117 | "cell_type": "code",
|
118 |
| - "outputs": [], |
| 118 | + "outputs": [ |
| 119 | + { |
| 120 | + "ename": "SyntaxError", |
| 121 | + "evalue": "unterminated string literal (detected at line 2) (1881836202.py, line 2)", |
| 122 | + "output_type": "error", |
| 123 | + "traceback": [ |
| 124 | + "\u001b[0;36m Cell \u001b[0;32mIn[81], line 2\u001b[0;36m\u001b[0m\n\u001b[0;31m API_KEY = \"\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unterminated string literal (detected at line 2)\n" |
| 125 | + ] |
| 126 | + } |
| 127 | + ], |
119 | 128 | "execution_count": null
|
120 | 129 | },
|
121 | 130 | {
|
|
163 | 172 | "source": [
|
164 | 173 | "##### Classification free text #####\n",
|
165 | 174 | "\n",
|
166 |
| - "# Only supported with NDJSON\n", |
| 175 | + "text_annotation = lb_types.ClassificationAnnotation(\n", |
| 176 | + " name=\"text_convo\",\n", |
| 177 | + " value=lb_types.Text(answer=\"the answer to the text questions right here\"),\n", |
| 178 | + " message_id=\"0\"\n", |
| 179 | + ")\n", |
| 180 | + "\n", |
| 181 | + "\n", |
167 | 182 | "text_annotation_ndjson = {\n",
|
168 | 183 | " 'name': 'text_convo',\n",
|
169 | 184 | " 'answer': 'the answer to the text questions right here',\n",
|
|
179 | 194 | "source": [
|
180 | 195 | "##### Checklist Classification ####### \n",
|
181 | 196 | "\n",
|
182 |
| - "# Only supported with NDJSON\n", |
| 197 | + "checklist_annotation= lb_types.ClassificationAnnotation(\n", |
| 198 | + " name=\"checklist_convo\", # must match your ontology feature's name\n", |
| 199 | + " value=lb_types.Checklist(\n", |
| 200 | + " answer = [\n", |
| 201 | + " lb_types.ClassificationAnswer(\n", |
| 202 | + " name = \"first_checklist_answer\"\n", |
| 203 | + " ), \n", |
| 204 | + " lb_types.ClassificationAnswer(\n", |
| 205 | + " name = \"second_checklist_answer\"\n", |
| 206 | + " )\n", |
| 207 | + " ]\n", |
| 208 | + " ),\n", |
| 209 | + " message_id=\"2\"\n", |
| 210 | + " )\n", |
| 211 | + "\n", |
| 212 | + "\n", |
183 | 213 | "checklist_annotation_ndjson = {\n",
|
184 | 214 | " 'name': 'checklist_convo',\n",
|
185 | 215 | " 'answers': [\n",
|
|
198 | 228 | "source": [
|
199 | 229 | "######## Radio Classification ######\n",
|
200 | 230 | "\n",
|
201 |
| - "# Only supported with NDJSON\n", |
| 231 | + "radio_annotation = lb_types.ClassificationAnnotation(\n", |
| 232 | + " name='radio_convo', \n", |
| 233 | + " value=lb_types.Radio(answer = lb_types.ClassificationAnswer(name = 'first_radio_answer')),\n", |
| 234 | + " message_id=\"0\"\n", |
| 235 | + ")\n", |
| 236 | + "\n", |
202 | 237 | "radio_annotation_ndjson = {\n",
|
203 | 238 | " 'name': 'radio_convo',\n",
|
204 | 239 | " 'answer': {\n",
|
|
374 | 409 | " global_key=global_key\n",
|
375 | 410 | " ),\n",
|
376 | 411 | " annotations=[\n",
|
377 |
| - " ner_annotation\n", |
| 412 | + " ner_annotation,\n", |
| 413 | + " text_annotation,\n", |
| 414 | + " checklist_annotation,\n", |
| 415 | + " radio_annotation\n", |
378 | 416 | " ]\n",
|
379 | 417 | " )\n",
|
380 | 418 | ")"
|
|
433 | 471 | " client = client, \n",
|
434 | 472 | " project_id = project.uid, \n",
|
435 | 473 | " name=f\"mal_job-{str(uuid.uuid4())}\", \n",
|
436 |
| - " predictions=label_ndjson)\n", |
| 474 | + " predictions=label)\n", |
437 | 475 | "\n",
|
438 | 476 | "upload_job.wait_until_done();\n",
|
439 | 477 | "print(\"Errors:\", upload_job.errors)\n",
|
|
458 | 496 | " client = client, \n",
|
459 | 497 | " project_id = project.uid, \n",
|
460 | 498 | " name=\"label_import_job\"+str(uuid.uuid4()), \n",
|
461 |
| - " # user label_ndjson if labels were created using python annotation tools\n", |
462 |
| - " labels=label_ndjson)\n", |
| 499 | + " labels=label)\n", |
463 | 500 | "\n",
|
464 | 501 | "upload_job.wait_until_done();\n",
|
465 | 502 | "print(\"Errors:\", upload_job.errors)\n",
|
|
0 commit comments