|
57 | 57 | }, |
58 | 58 | { |
59 | 59 | "cell_type": "code", |
60 | | - "execution_count": 2, |
| 60 | + "execution_count": 9, |
61 | 61 | "id": "everyday-street", |
62 | 62 | "metadata": { |
63 | 63 | "id": "everyday-street" |
64 | 64 | }, |
65 | 65 | "outputs": [], |
66 | 66 | "source": [ |
67 | 67 | "from labelbox import Project, Dataset, Client, DataRow\n", |
68 | | - "from labelbox.schema.queue_mode import QueueMode\n", |
69 | | - "from labelbox.schema.media_type import MediaType\n", |
70 | 68 | "import random\n", |
71 | 69 | "import uuid\n", |
72 | 70 | "import os" |
|
85 | 83 | }, |
86 | 84 | { |
87 | 85 | "cell_type": "code", |
88 | | - "execution_count": 3, |
| 86 | + "execution_count": 10, |
89 | 87 | "id": "thick-gasoline", |
90 | 88 | "metadata": { |
91 | 89 | "id": "thick-gasoline" |
|
104 | 102 | "# For the purpose of this demo get a single project/dataset id from your organization\n", |
105 | 103 | "\n", |
106 | 104 | "# Get a single Project id\n", |
107 | | - "projects = client.get_projects()\n", |
108 | | - "project_id=list(projects)[0].uid\n", |
109 | | - "project_name=list(projects)[0].name\n", |
| 105 | + "# get_projects returns a PaginatedCollection object, which is iterable. \n", |
| 106 | + "project = next(client.get_projects())\n", |
| 107 | + "project_id=project.uid\n", |
| 108 | + "project_name=project.name\n", |
110 | 109 | "print(\"Project ID: \", project_id)\n", |
111 | 110 | "print(\"Project Name:\", project_name)\n", |
112 | | - "print(\"Number of projects in your org:\", len(list(projects)))\n", |
113 | 111 | "\n", |
114 | 112 | "print(\"-\" * 40)\n", |
115 | 113 | "\n", |
116 | 114 | "# Get a single dataset id\n", |
117 | | - "datasets = client.get_datasets()\n", |
118 | | - "dataset_id = list(datasets)[0].uid\n", |
119 | | - "dataset_name = list(datasets)[0].name\n", |
| 115 | + "# get_datasets returns a PaginatedCollection object, which is iterable. \n", |
| 116 | + "dataset = next(client.get_datasets())\n", |
| 117 | + "dataset_id = dataset.uid\n", |
| 118 | + "dataset_name = dataset.name\n", |
120 | 119 | "print(\"Dataset ID: \", dataset_id)\n", |
121 | | - "print(\"Dataset Name:\" , dataset_name)\n", |
122 | | - "print(\"Number of datasets in your org:\", len(list(datasets)))" |
| 120 | + "print(\"Dataset Name:\" , dataset_name)" |
123 | 121 | ], |
124 | 122 | "metadata": { |
125 | 123 | "colab": { |
126 | 124 | "base_uri": "https://localhost:8080/" |
127 | 125 | }, |
128 | 126 | "id": "F_payZKCiX56", |
129 | | - "outputId": "45123f80-6d04-4c83-8390-ec1d2f82ff3f" |
| 127 | + "outputId": "d8334a02-a62f-4b8b-a63c-5f43512fede4" |
130 | 128 | }, |
131 | 129 | "id": "F_payZKCiX56", |
132 | | - "execution_count": 4, |
| 130 | + "execution_count": 13, |
133 | 131 | "outputs": [ |
134 | 132 | { |
135 | 133 | "output_type": "stream", |
136 | 134 | "name": "stdout", |
137 | 135 | "text": [ |
138 | | - "Project ID: cl9rmkr5a4hiy07v5ey34ahtk\n", |
139 | | - "Project Name: label_import_project_demo\n", |
140 | | - "Number of projects in your org: 88\n", |
| 136 | + "Project ID: cl9smiqo23hk307y27k42cajv\n", |
| 137 | + "Project Name: html-editor\n", |
141 | 138 | "----------------------------------------\n", |
142 | | - "Dataset ID: cl9rmksvo3wv207y6h158giqo\n", |
143 | | - "Dataset Name: annotation_import_demo_dataset\n", |
144 | | - "Number of datasets in your org: 78\n" |
| 139 | + "Dataset ID: cl9sywtkj2gsv07vk2isaeadj\n", |
| 140 | + "Dataset Name: text_test.json\n" |
145 | 141 | ] |
146 | 142 | } |
147 | 143 | ] |
148 | 144 | }, |
149 | 145 | { |
150 | 146 | "cell_type": "code", |
151 | | - "execution_count": 5, |
| 147 | + "execution_count": 14, |
152 | 148 | "id": "victorian-consumer", |
153 | 149 | "metadata": { |
154 | 150 | "id": "victorian-consumer" |
|
162 | 158 | }, |
163 | 159 | { |
164 | 160 | "cell_type": "code", |
165 | | - "execution_count": 6, |
| 161 | + "execution_count": 15, |
166 | 162 | "id": "industrial-onion", |
167 | 163 | "metadata": { |
168 | 164 | "id": "industrial-onion", |
169 | | - "outputId": "340c857a-8aba-428c-ae0e-04d5565ccb8f", |
| 165 | + "outputId": "965cb071-45bf-458e-edd4-e82781c58e7a", |
170 | 166 | "colab": { |
171 | 167 | "base_uri": "https://localhost:8080/" |
172 | 168 | } |
|
176 | 172 | "output_type": "stream", |
177 | 173 | "name": "stdout", |
178 | 174 | "text": [ |
179 | | - "Project: <Project {'auto_audit_number_of_labels': 1, 'auto_audit_percentage': 1, 'created_at': datetime.datetime(2022, 10, 27, 22, 16, 33, tzinfo=datetime.timezone.utc), 'description': '', 'last_activity_time': datetime.datetime(2022, 10, 27, 22, 16, 46, tzinfo=datetime.timezone.utc), 'media_type': <MediaType.Image: 'IMAGE'>, 'name': 'label_import_project_demo', 'queue_mode': <QueueMode.Batch: 'BATCH'>, 'setup_complete': datetime.datetime(2022, 10, 27, 22, 16, 45, tzinfo=datetime.timezone.utc), 'uid': 'cl9rmkr5a4hiy07v5ey34ahtk', 'updated_at': datetime.datetime(2022, 10, 27, 22, 16, 46, tzinfo=datetime.timezone.utc)}>\n", |
180 | | - "Dataset: <Dataset {'created_at': datetime.datetime(2022, 10, 27, 22, 16, 36, tzinfo=datetime.timezone.utc), 'description': '', 'name': 'annotation_import_demo_dataset', 'row_count': 5, 'uid': 'cl9rmksvo3wv207y6h158giqo', 'updated_at': datetime.datetime(2022, 10, 27, 22, 16, 37, tzinfo=datetime.timezone.utc)}>\n" |
| 175 | + "Project: <Project {'auto_audit_number_of_labels': 1, 'auto_audit_percentage': 1, 'created_at': datetime.datetime(2022, 10, 28, 15, 2, 45, tzinfo=datetime.timezone.utc), 'description': '', 'last_activity_time': datetime.datetime(2022, 10, 28, 15, 47, 41, tzinfo=datetime.timezone.utc), 'media_type': <MediaType.Image: 'IMAGE'>, 'name': 'html-editor', 'queue_mode': <QueueMode.Batch: 'BATCH'>, 'setup_complete': None, 'uid': 'cl9smiqo23hk307y27k42cajv', 'updated_at': datetime.datetime(2022, 10, 28, 15, 47, 41, tzinfo=datetime.timezone.utc)}>\n", |
| 176 | + "Dataset: <Dataset {'created_at': datetime.datetime(2022, 10, 28, 20, 49, 38, tzinfo=datetime.timezone.utc), 'description': '', 'name': 'text_test.json', 'row_count': 3, 'uid': 'cl9sywtkj2gsv07vk2isaeadj', 'updated_at': datetime.datetime(2022, 10, 28, 20, 49, 40, tzinfo=datetime.timezone.utc)}>\n" |
181 | 177 | ] |
182 | 178 | } |
183 | 179 | ], |
|
200 | 196 | }, |
201 | 197 | { |
202 | 198 | "cell_type": "code", |
203 | | - "execution_count": 7, |
| 199 | + "execution_count": 16, |
204 | 200 | "id": "guided-institute", |
205 | 201 | "metadata": { |
206 | 202 | "id": "guided-institute", |
207 | | - "outputId": "9fe66adc-8336-431a-cea1-91942e4939bc", |
| 203 | + "outputId": "7805c5e3-ba99-4c91-98f8-fc69575f64fc", |
208 | 204 | "colab": { |
209 | 205 | "base_uri": "https://localhost:8080/" |
210 | 206 | } |
|
214 | 210 | "output_type": "stream", |
215 | 211 | "name": "stdout", |
216 | 212 | "text": [ |
217 | | - "label_import_project_demo\n", |
218 | | - "annotation_import_demo_dataset\n" |
| 213 | + "html-editor\n", |
| 214 | + "text_test.json\n" |
219 | 215 | ] |
220 | 216 | } |
221 | 217 | ], |
|
236 | 232 | }, |
237 | 233 | { |
238 | 234 | "cell_type": "code", |
239 | | - "execution_count": 8, |
| 235 | + "execution_count": 17, |
240 | 236 | "id": "according-subdivision", |
241 | 237 | "metadata": { |
242 | 238 | "id": "according-subdivision", |
243 | 239 | "colab": { |
244 | 240 | "base_uri": "https://localhost:8080/" |
245 | 241 | }, |
246 | | - "outputId": "9bc9e80d-3bce-43f5-a18d-554174fb8a7a" |
| 242 | + "outputId": "18faa683-fbd5-48ce-abb5-6a6c93464b23" |
247 | 243 | }, |
248 | 244 | "outputs": [ |
249 | 245 | { |
|
273 | 269 | }, |
274 | 270 | { |
275 | 271 | "cell_type": "code", |
276 | | - "execution_count": 9, |
| 272 | + "execution_count": 18, |
277 | 273 | "id": "ideal-processing", |
278 | 274 | "metadata": { |
279 | 275 | "id": "ideal-processing", |
280 | | - "outputId": "c1d7ac49-31d4-4949-896d-8765f5954436", |
| 276 | + "outputId": "ea10e564-fe27-47f1-8993-1d03d2be26a7", |
281 | 277 | "colab": { |
282 | 278 | "base_uri": "https://localhost:8080/" |
283 | 279 | } |
|
303 | 299 | }, |
304 | 300 | { |
305 | 301 | "cell_type": "code", |
306 | | - "execution_count": 10, |
| 302 | + "execution_count": 19, |
307 | 303 | "id": "convinced-force", |
308 | 304 | "metadata": { |
309 | 305 | "id": "convinced-force", |
310 | 306 | "colab": { |
311 | 307 | "base_uri": "https://localhost:8080/" |
312 | 308 | }, |
313 | | - "outputId": "3aff953b-efc4-4f1e-f2cd-575c3e78c01a" |
| 309 | + "outputId": "b6afc495-fd71-4ac1-9e42-3fcaa6fa1802" |
314 | 310 | }, |
315 | 311 | "outputs": [ |
316 | 312 | { |
|
345 | 341 | }, |
346 | 342 | { |
347 | 343 | "cell_type": "code", |
348 | | - "execution_count": 11, |
| 344 | + "execution_count": 20, |
349 | 345 | "id": "cubic-joint", |
350 | 346 | "metadata": { |
351 | 347 | "id": "cubic-joint", |
352 | | - "outputId": "f02e5758-6db7-44a3-cf2b-937164e18bda", |
| 348 | + "outputId": "b4ac9639-a362-4f6e-cbef-7c0a032b3b1f", |
353 | 349 | "colab": { |
354 | 350 | "base_uri": "https://localhost:8080/" |
355 | 351 | } |
|
359 | 355 | "output_type": "stream", |
360 | 356 | "name": "stdout", |
361 | 357 | "text": [ |
362 | | - "<labelbox.pagination.PaginatedCollection object at 0x7f463f4e70d0>\n", |
363 | | - "<Project {'auto_audit_number_of_labels': 1, 'auto_audit_percentage': 1, 'created_at': datetime.datetime(2022, 10, 27, 22, 16, 33, tzinfo=datetime.timezone.utc), 'description': 'new description field', 'last_activity_time': datetime.datetime(2022, 10, 28, 13, 20, 59, tzinfo=datetime.timezone.utc), 'media_type': <MediaType.Image: 'IMAGE'>, 'name': 'label_import_project_demo', 'queue_mode': <QueueMode.Batch: 'BATCH'>, 'setup_complete': datetime.datetime(2022, 10, 27, 22, 16, 45, tzinfo=datetime.timezone.utc), 'uid': 'cl9rmkr5a4hiy07v5ey34ahtk', 'updated_at': datetime.datetime(2022, 10, 28, 13, 20, 59, tzinfo=datetime.timezone.utc)}>\n", |
| 358 | + "<labelbox.pagination.PaginatedCollection object at 0x7fe3c7a49e90>\n", |
| 359 | + "<Project {'auto_audit_number_of_labels': 1, 'auto_audit_percentage': 1, 'created_at': datetime.datetime(2022, 10, 28, 15, 2, 45, tzinfo=datetime.timezone.utc), 'description': 'new description field', 'last_activity_time': datetime.datetime(2022, 11, 1, 19, 18, 21, tzinfo=datetime.timezone.utc), 'media_type': <MediaType.Image: 'IMAGE'>, 'name': 'html-editor', 'queue_mode': <QueueMode.Batch: 'BATCH'>, 'setup_complete': None, 'uid': 'cl9smiqo23hk307y27k42cajv', 'updated_at': datetime.datetime(2022, 11, 1, 19, 18, 21, tzinfo=datetime.timezone.utc)}>\n", |
364 | 360 | "None\n", |
365 | 361 | "None\n" |
366 | 362 | ] |
|
412 | 408 | "id": "future-bargain", |
413 | 409 | "metadata": { |
414 | 410 | "id": "future-bargain", |
415 | | - "outputId": "f4c2980b-9b06-41c9-be36-7dfb5b4429bf", |
| 411 | + "outputId": "a2e32b99-8bd7-4b24-ce5a-171b3a2c6441", |
416 | 412 | "colab": { |
417 | 413 | "base_uri": "https://localhost:8080/" |
418 | 414 | } |
|
422 | 418 | "output_type": "stream", |
423 | 419 | "name": "stdout", |
424 | 420 | "text": [ |
425 | | - " Name of project : label_import_project_demo\n", |
426 | | - " Name of batches in project: first-batch-LI-demo\n" |
| 421 | + " Name of project : html-editor\n", |
| 422 | + " Name of batches in project: testsss\n" |
427 | 423 | ] |
428 | 424 | } |
429 | 425 | ], |
|
0 commit comments