You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/README.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -82,3 +82,9 @@ Learn more about annotation types in the [docs](https://docs.labelbox.com/docs/a
82
82
| Model Diagnostics Demo |[Github](model_diagnostics/model_diagnostics_demo.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/model_diagnostics/model_diagnostics_demo.ipynb)|
83
83
| Custom Metrics Basics |[Github](model_diagnostics/custom_metrics_basics.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/model_diagnostics/custom_metrics_basics.ipynb)|[Docs](https://docs.labelbox.com/docs/model-diagnostics)|
84
84
| Custom Metrics Demo |[Github](model_diagnostics/custom_metrics_demo.ipynb)|[](https://colab.research.google.com/github/Labelbox/labelbox-python/blob/develop/examples/model_diagnostics/custom_metrics_demo.ipynb)|
"source": "# If you don't want to give google access to drive you can skip this cell\n# and manually set `API_KEY` below.\n\nCOLAB = \"google.colab\" in str(get_ipython())\nif COLAB:\n !pip install colab-env -qU\n from colab_env import envvar_handler\n envvar_handler.envload()\n\nAPI_KEY = os.environ.get(\"LABELBOX_API_KEY\")\nif not os.environ.get(\"LABELBOX_API_KEY\"):\n API_KEY = getpass(\"Please enter your labelbox api key\")\n if COLAB:\n envvar_handler.add_env(\"LABELBOX_API_KEY\", API_KEY)"
"source": "PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\nDATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\nPROJECT_NAME = \"Sample Project\"\nDATASET_NAME = \"Example Jellyfish Dataset\"\n# Only update this if you have an on-prem deployment\nENDPOINT = \"https://api.labelbox.com/graphql\""
109
+
"source": [
110
+
"PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\n",
111
+
"DATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\n",
112
+
"PROJECT_NAME = \"Sample Project\"\n",
113
+
"DATASET_NAME = \"Example Jellyfish Dataset\"\n",
114
+
"# Only update this if you have an on-prem deployment\n",
115
+
"ENDPOINT = \"https://api.labelbox.com/graphql\""
116
+
]
113
117
},
114
118
{
115
119
"cell_type": "markdown",
@@ -120,21 +124,38 @@
120
124
"* Starting point for all db interactions"
121
125
]
122
126
},
127
+
{
128
+
"cell_type": "markdown",
129
+
"id": "485451ad",
130
+
"metadata": {},
131
+
"source": [
132
+
"# API Key and Client\n",
133
+
"Provide a valid api key below in order to properly connect to the Labelbox Client."
"source": "# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n# Iterate over them to get the items out.\nnext(labels_paginated_collection)\n# list(paginated...) should be avoided for queries that could return more than a dozen results"
270
+
"source": [
271
+
"# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n",
272
+
"# Iterate over them to get the items out.\n",
273
+
"next(labels_paginated_collection)\n",
274
+
"# list(paginated...) should be avoided for queries that could return more than a dozen results"
275
+
]
238
276
},
239
277
{
240
278
"cell_type": "markdown",
@@ -263,7 +301,21 @@
263
301
]
264
302
}
265
303
],
266
-
"source": "datasets = client.get_datasets(where=Dataset.name == DATASET_NAME)\n\nprojects = client.get_projects(\n where=((Project.name == PROJECT_NAME) &\n (Project.description == \"new description field\")))\n\n# The above two queries return PaginatedCollections because the filter parameters aren't guaranteed to be unique.\n# So even if there is one element returned it is in a paginatedCollection.\nprint(projects)\nprint(next(projects, None))\nprint(next(projects, None))\nprint(next(projects, None))\n# We can see there is only one."
"# The above two queries return PaginatedCollections because the filter parameters aren't guaranteed to be unique.\n",
312
+
"# So even if there is one element returned it is in a paginatedCollection.\n",
313
+
"print(projects)\n",
314
+
"print(next(projects, None))\n",
315
+
"print(next(projects, None))\n",
316
+
"print(next(projects, None))\n",
317
+
"# We can see there is only one."
318
+
]
267
319
},
268
320
{
269
321
"cell_type": "markdown",
@@ -305,7 +357,11 @@
305
357
"output_type": "execute_result"
306
358
}
307
359
],
308
-
"source": "# Dataset has a Relationship to a Project so we can use the following\nlist(dataset.projects())\n# This will return all projects that are attached to this dataset"
360
+
"source": [
361
+
"# Dataset has a Relationship to a Project so we can use the following\n",
362
+
"list(dataset.projects())\n",
363
+
"# This will return all projects that are attached to this dataset"
0 commit comments